Friday, August 24, 2007

Dynamically / programmatically changing connection strings of ASP.NET 2.0 providers at run time

Recently, I've been using .NET web parts and personalization on a project. I am pretty happy with the drag and drop feature and how the personalization works, until I was required to change the connection string of personalization database (Application service database) dynamically on run time, instead of declaring it on web.config. Took hours to find a solution or reference to the issue. Finally, found it out in Scott Gu blog, source code for the built in providers in ASP.NET 2.0, what a relieve!  You can check it in here http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx

So I modify the source code a bit, recompile and change the type of provider in the config file and jobs done.

Monday, August 13, 2007

IE7's absolute positioning problem when overflow is auto

Recently, I was faced with a weird absolute positioning problem that only happen in IE7. Basically, I have several span tag with absolute position inside a div tag with "overflow:auto", it displays correctly in IE6 and Firefox 1.5 onwards, the object was positioned perfectly. The problem arise when one of our customers upgraded their browser to IE 7 and reported the problem, where text appear all over the places. "The problem doesn't happen until we scrolled further down to the div area wasn't visible initially."  It was quite some time to discover the cause of the problem, pasting the HTML to W3C mark up validator (http://validator.w3.org/) and no problem found. I tried to change the overflow from auto to "overflow:scroll" and the problem gone.

I finally ended up setting a different style for IE7, there is a good reference on how to set CSS to specific browser http://www.webdevout.net/css-hacks#in_css-hyphen.

Anyway, if you have a problem with web page's positioning and it only happen in IE7, it worth to try the solution above and hopefully the problem goes away.