WebControls in Runtime

P

PauloFor

Please,

In my webform I use this for include control : ( design time )

<%@ Register TagPrefix="inc" TagName="public" Src="public.ascx" %>

But Can I define control in runtime ? How ?

Thanks.
 
V

Victor Garcia Aprea [MVP]

Hi Paulo,

Take a look at the LoadControl method.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
and not by private mail.
 
J

Jenny

Hi, Victor:

In test.aspx page, I have:
<%@ Reference Control="./user_control/e_multi_choice.ascx" %>

In test.aspx.vb page, I have:

Dim mcFab As e_multi_choice =
CType(LoadControl("./user_control/e_multi_choice.ascx"), e_multi_choice)

CType(mcFab, e_multi_choice).Table = "Table1"

CType(mcFab, e_multi_choice).Caption = "Table 1 Title"

If I put this piece of code in Page_load event, it works fine. However,
if I put it under a Button_Click event, the property value doesn't get
passed.

Please advise. Thank you very much.

Jenny
 

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

Similar Threads

MS Webcontrols - tabstrip 0
Arduino Chess Clock 0
Multiple User Controls 1
Login form no longer working 2
nesting webcontrols 0
Webcontrols VS 2003 install 0
PHP error 1
Errors adding user control in web application 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top