|
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.
|