Need help with LoadControl

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Need help with LoadControl

    When I try to use LoadControl I get the error message below. Any help would
    be great.

    Kurt

    Control '_ctl0_Classification' of type 'TextBox' must be placed inside a
    form tag with runat=server


    Kurt Guest

  2. Similar Questions and Discussions

    1. LoadControl and Validation Summary
      I am working on a project that dynamically loads controls from within Page_init so that the viewstate is preserved. On post back the control saves...
    2. LoadControl and CType error
      Hey. I'm trying to dynamically add User Controls to my page. It appears to work sometimes, but more often I get the error: Unable to cast object of...
    3. LoadControl performance
      How is LoadControl's performance compared to adding a control directly on the WebForm designer? TWH
    4. When does LoadControl really load the control?
      Hi, I'm loading a user control (.ascx) with LoadControl in a code-behind page. LoadControl returns successfully, and the valid reference it...
    5. loadcontrol
      Will the state of a dynamically loaded control preserved in transitions between aspx pages hosting the control.? thanks
  3. #2

    Default Re: Need help with LoadControl

    Any control that can cause PostBAck should be placed within <form> tags...

    <form
    ... All PostBack controls go here.
    </form>

    --
    Naveen K Kohli
    [url]http://www.netomatix.com[/url]
    "Kurt" <k_nojunk@larimore.net> wrote in message
    news:OSG%23jvBQDHA.1748@TK2MSFTNGP11.phx.gbl...
    > When I try to use LoadControl I get the error message below. Any help
    would
    > be great.
    >
    > Kurt
    >
    > Control '_ctl0_Classification' of type 'TextBox' must be placed inside a
    > form tag with runat=server
    >
    >

    Naveen K Kohli Guest

  4. #3

    Default Re: Need help with LoadControl

    Hi,
    To be more accurate. All "web forms" controls must be under Form tag
    with runat=server attribute. this attribute guarantee the postback
    behavior.

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

  5. #4

    Default Re: Need help with LoadControl

    How do I control that if I am loading a control dynamically?

    Kurt

    "Natty Gur" <natty@dao2com.com> wrote in message
    news:uG1wKaFQDHA.3192@tk2msftngp13.phx.gbl...
    > Hi,
    > To be more accurate. All "web forms" controls must be under Form tag
    > with runat=server attribute. this attribute guarantee the postback
    > behavior.
    >
    > Natty Gur, CTO
    > Dao2Com Ltd.
    > 28th Baruch Hirsch st. Bnei-Brak
    > Israel , 51114
    >
    > Phone Numbers:
    > Office: +972-(0)3-5786668
    > Fax: +972-(0)3-5703475
    > Mobile: +972-(0)58-888377
    >
    > Know the overall picture
    >
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Kurt Guest

  6. #5

    Default Re: Need help with LoadControl

    I got it this is what I used.
    this.FindControl("Test").Controls.Add(offense);

    "William F. Robertson, Jr." <wfrobertson@kpmg.com> wrote in message
    news:%23QJScRLQDHA.1608@TK2MSFTNGP11.phx.gbl...
    > How are you trying to load it in code? Do you have a placeholder?
    >
    > bill
    >
    > "Kurt" <k_nojunk@larimore.net> wrote in message
    > news:O0ZD4LKQDHA.3144@tk2msftngp13.phx.gbl...
    > > How do I control that if I am loading a control dynamically?
    > >
    > > Kurt
    > >
    > > "Natty Gur" <natty@dao2com.com> wrote in message
    > > news:uG1wKaFQDHA.3192@tk2msftngp13.phx.gbl...
    > > > Hi,
    > > > To be more accurate. All "web forms" controls must be under Form tag
    > > > with runat=server attribute. this attribute guarantee the postback
    > > > behavior.
    > > >
    > > > Natty Gur, CTO
    > > > Dao2Com Ltd.
    > > > 28th Baruch Hirsch st. Bnei-Brak
    > > > Israel , 51114
    > > >
    > > > Phone Numbers:
    > > > Office: +972-(0)3-5786668
    > > > Fax: +972-(0)3-5703475
    > > > Mobile: +972-(0)58-888377
    > > >
    > > > Know the overall picture
    > > >
    > > >
    > > > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > > > Don't just participate in USENET...get rewarded for it!
    > >
    > >
    >
    >

    Kurt Guest

  7. #6

    Default Re: Need help with LoadControl

    this.FindControl("FormName").Controls.Add(MyContro l);

    Natty Gur, CTO
    Dao2Com Ltd.
    28th Baruch Hirsch st. Bnei-Brak
    Israel , 51114

    Phone Numbers:
    Office: +972-(0)3-5786668
    Fax: +972-(0)3-5703475
    Mobile: +972-(0)58-888377

    Know the overall picture


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Natty Gur Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139