Categories
.net ASP.Net

Accessing controls in OnPreInit method might be tricky when MasterPage is used

Today I've come across an odd problem. I had to set SkinID property of a control dynamically and this step can be achieved only during PreInit event (OnPreInit method). It is a no brainer implementing the code on standalone Page.

protected override void OnPreInit(EventArgs e) { SomeControl.SkinID="TuboSkin"; base.OnPreInit(e); }

But when the page is hosted on MasterPage the code above throws a Object reference not set to an instance of an object, yep, SomeControl is null for some reason that has to do with MasterPage composition. After googling around for quite some time I've found the solution and explanation to the problem, thanks to Simon's post. The solutions is to call Page.Master property before accessing any of the controls, like this:

protected override void OnPreInit(EventArgs e) { System.Web.UI.MasterPage dummy = Master; SomeControl.SkinID="TuboSkin"; base.OnPreInit(e); }
Categories
.net ASP.Net Slovenia Windows

WPF/E at work

I know I am bit late, but nevertheless, if you want to see a nice and cool example of WPF/E driven web pages then you must navigate to www.windowsvista.si. Even if the page(s) are in Slovene you should understand much of what you’ll see.

NOTE: WPF/E February CTP is used. If you don’t have it installed then click on the top icon on the front page to install it. After you have WPF/E on local machine you should click on one of the two bottom icons. Enjoy.

Categories
.net ASP.Net

telerik switches from 4 to 3 releases per year

[tele] recently announced that it will reduce the pace of releases from 4 to 3 per year. Don’t be misleaded as this doesn’t mean they will provide less products or updates. It is actually the inverse – they will have more time to work on their products and they’ll spend less time for “release” activities.

I think they did the right move. I mean, I’ve found myself often installing their updates and updating my projects which took my time, too. Actually I find myself very often upgrading various stuff through the day. And the fact that they’ll have more time to actually do some work on the products is a positive one, too. So, all in all, 3 releases per year seems like a good compromise to me and customers will certainly benefit from this change.

Categories
.net ASP.Net

Visual Studio 2005 "kindly" starts an asp.net development server per project

I have a solution containing both WinForms and asp.net projects. There is nothing wrong with this. However, when I set a configuration that runs only a single WinForms project where all of the asp.net projects aren’t even marked for build and start debugging I still get an asp.net development server per asp.net project – that’s two development servers for me. Or better, that’s two useless, memory and CPU cycles wasting development servers running in background.

One would think that this is some sort of bug, so did I. But hey, no, this is by design:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=119989

Isn’t that generous from Visual Studio 2005 – to give me more than I asked for?

Anyway, I’ve reopened bug report:

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=253357

Categories
.net ASP.Net

PDB files are sometimes added to Source Safe when doing asp.net 2.0 projects

This is a very annoying VS2005 bug: PDB files residing in bin folder are sometimes added to source safe when you are doing an asp.net 2.0 project. This causes problems with source safe operations (i.e. Get Latest Version) and compile process as those files are marked read-only when they are under source control. The problem is described in details in this thread and this blog post. There is also a known KB article 915110.

One of the solutions is to download this hotfix which is rather tedious as you have to contact PSS to get it. Fortunately there is another way. You get this hotfix by downloading (public free download) “Microsoft Visual Studio 2005 – Update to Support Web Application Projects” which is some sort of addition to VS2005 (it doesn’t forces you to how to do asp.net 2.0 projects in any way). I just installed it and it seems OK so far.

Categories
.net ASP.Net

Page fragment caching and Ajax

After finding a proper way to do page fragment caching (caching UserControls) and Ajax I wrote an how to article. Read it here.