Where did Designer.CS go?

Alright so…on my latest project I decided to use .NET 2.0. Things were going great, until I ran into the following scenario (if you googled to here, skip my rant and just go to the solution…it’s down there somewhere)

…I had a user created control. This control consisted of 4 dependant drop down lists and a submit button, all of which are AJAX based utilizing Jason Diamond’s library generating of a DB2 backend. Neat-0. I wanted to trigger an event on my main page (default.aspx) when the submit button was clicked on my user-created control (AjaxDropDownMenu.ascx) Here is where the .Net 2.0 challenges began. First off, if I added the following to my user control code…

//code

Protected System.Web.Ui.WebControls.Button = new System.Web.Ui.WebControls.Button();

(Actually, since this was an anthem button that isn’t correct, but for the purposes of this post we’ll leave it be…)

//end code

Alright – so that error made sense….uhmm…mostly. VS.NET 2k5 uses partial classes. So an error (forgive me, I don't have the exact error I'm not on my coding machine...) stating that this declaration makes sense because it's declared somewhere else. The problem with that is that the declaration is nowhere to be found. A little googling makes it seem like VS.NET 2k5 should create a FileName.Designer.cs file for each ASPX file...However, VS.NET 2k5 does not do this...The Web Application Projects add-on however, does. The trouble with this is, it's only really convenient if you started your web application with this application already installed(Update: ScottGU has a guide for converting existing sites!). ScottGU has an excellent explanation here However, this entire thing really leaves something to be desired for me, but that's really only because I started coding 25% of this project without this "Add-on" My main question is...If I don't have the "Add-on" how on earth am I supposed to modify the protection level of a control (change it from protected to public, for example)

What I ended up doing was simply creating my button() programmatically. Sheesh.

Oh, one more thing. If you've already coded a bit in VS.NET 2k5, and you figure hey - I'll just go install the Web Application Projects add-on and be good to go...you have another thing coming. It will not create the FileName.Designer.cs files for you if the files have already been created. (Is there a way to manually add these? If there is - I certainly haven't stumbled across it) I believe you must create a "Web Application Project" (read:not web site) within VS.NET 2k5 for these files to get generated.

This link from ScottGU should answer most of your questions if youre experiencing this challenge, as my boss would say.

Print | posted on Monday, April 17, 2006 11:11 PM

Feedback

# re: Where did Designer.CS go?

left by scottgu at 4/18/2006 12:07 AM Gravatar
This tutorial walksthrough migrating an existing VS 2005 Web Site Project to be a VS 2005 Web Application Project: http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx

It avoids you having to manually create these files and should make like pretty easy.

Hope this helps,

Scott

# re: Where did Designer.CS go?

left by Sanjay at 4/18/2006 1:04 AM Gravatar
Excellent Scott - thank you.

# re: Where did Designer.CS go?

left by Rajiv Popat at 4/26/2006 12:38 PM Gravatar
Thanks for the comment on my post, clarifying things a little bit more and pointing my out to web solution project - I heard about thingy multiple time before and had been towing with the idea of downloading it - just that I didn't have any projects to migrate and thought since I'm developing projects in VS.NET 2005 from scratch why bother?

I guess this is the much needed push that I was waiting for. I guess I'll play around with it on tommorrow.

Personally I feel, this is a nice way for Microsoft to say "oops! we did it, now we're undoing it!":) which is quite nice of any company to do! I've also heard it's supported - which is cool!!
Title  
Name
Email (never displayed)
Url
Comments   
Please add 4 and 7 and type the answer here: