Since this is a combination of the IDE and ASP.NET, I'm including them both in my header.
I really like ASP.NET user controls. They are an extremely flexible way to add stock functionality and appearance to a website. We use them quite extensively on the city's website.
So what's wrong? Simple. You can't talk to a user control that you drag/drop onto the form unless you go into the code-behind and manually add a reference to the control.
To see this in action, create a UserControl. Add a label to the user control. Add a Public property to the UserControl that would change the text in the label.
Create a new web form. Drag the UserControl that you have created to the web form.
Now, in the Page_Load event, try to set the property. You'll notice that you don't get any Intellisense because the IDE doesn't know about it, and if you try to compile, you'll get an error because the UserControl only exists on the page, not in the class.
I've got one page that has 19 seperate UserControls with a lot of logic in the controls that I need to be able to speak to. It's a pain in the ass to have to go into my code behind and type "Public Blah As BlahControl" over and over and over and over...
Why isn't there an automated add-in to VS.NET that would maintain those automatically for you?
No comments:
Post a Comment