User Controls and wireup

Last post 05-16-2008 4:14 AM by Ivan Xin - MSFT. 2 replies.

Sort Posts:

  • User Controls and wireup

    05-14-2008, 8:26 PM
    • Loading...
    • LAMarrano
    • Joined on 06-26-2006, 7:20 PM
    • Posts 4

    I have a user control that is exhibiting strange problems in my web application.  Whenever I drop the user control on the form, it doesn't get declared in the code behind, and subsequent controls that are added to the form are also not added to the code-behind (designer).  The entire project compiles, so it is not a problem with a control that doesn't run.  Does anyone have any experience with a problem like this and can offer tips or pointers on where to look to see what might be causing this user control to not work?

    (Hopefull) TIA,

    LAMarrano

    BTW, this is on .NET 2.0 and VS 2005.

    Filed under:
  • Re: User Controls and wireup

    05-14-2008, 9:54 PM
    • Loading...
    • yonahw
    • Joined on 06-07-2007, 12:02 PM
    • Posts 68

     you can always declare the control yourself manually

  • Re: User Controls and wireup

    05-16-2008, 4:14 AM
    Answer

    Hi LAMarrano,

          How did you "drop" your user control?

          If you want to use Drag-and -drop in the VS2005, then you should drag that user control on to the design view of the IDE but not the source view. In this way the corresponding codes will get generated automatically for you.

          Also, you can do this all manully. By writing something like this on your .aspx file.

    <%@ Register Src="WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %>
    <uc1:WebUserControl ID="WebUserControl1" runat="server" />

    Regards,

    Ivan.


     

Page 1 of 1 (3 items)