Using dynamic usercontrols

D

David

Hi all,

Developing in VS 2005, VB.NET


An application I am working with currently has everything in one page, but
will really be suited to being modular, hence the idea of using dynamic user
controls.

When the page gets submitted, the submit button is on the page rather than
any user controls. So, the action of the submit needs to know about the user
control. I can handle this (mostly).


My UC has various text boxes. I am bringing them out as properties in the
UC. When I press submit, I can see the values in the properties just fine,
however, I don't think it is really that dynamic, as I have to declare the
UC prior to any page functions.

currently, I have...

Dim TravelUC = LoadControl(ResolveUrl("~/PathToUC"))

in my pageload I have
Panel.Controls.Add(TravelUC)

In my button submit I have...
label.Text = TravelUC.TextBoxValue() 'this is the property in the UC
which has TextBox.Text as its return value.

The way I would prefer is to be able to just load the UC based on certain
criteria. As it currently stands, my TravelUC will always be loaded, wether
being used or not. I can't do the loadcontrol in the pageload as the
TravelUC.TextBoxValue() is then not visible.

Any ideas on how I can have the UC loaded wherever/whenever I want it rather
than all the time?

Thanks.

Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top