WebControls in Runtime

Discussion in 'ASP .Net Web Controls' started by PauloFor, Jul 10, 2003.

  1. PauloFor

    PauloFor Guest

    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.
     
    PauloFor, Jul 10, 2003
    #1
    1. Advertising

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

    "PauloFor" <> wrote in message
    news:%...
    > 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.
    >
    >
     
    Victor Garcia Aprea [MVP], Jul 12, 2003
    #2
    1. Advertising

  3. PauloFor

    Jenny Guest

    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









    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Jenny, Jul 31, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Leif

    WebControls Button

    Leif, Jun 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    850
  2. Rhys Gravell

    Re: WebControls Button

    Rhys Gravell, Jun 25, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    873
    Rhys Gravell
    Jun 25, 2003
  3. John Smith

    Clearing values in WebControls

    John Smith, Jun 28, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    443
    John Smith
    Jun 29, 2003
  4. Hal Vaughan
    Replies:
    11
    Views:
    1,119
    Gordon Beaton
    May 22, 2006
  5. Annick Van Hoof

    Generating webcontrols in runtime

    Annick Van Hoof, Feb 16, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    137
Loading...

Share This Page