how to set up runat="server" in webcontrol



How can I set up runat="server" in dynamic added UserControl ?

I have my control created in designer. When I use drag & drop
to implement it in website it works.

when I use code:

Control zlecenie = new Control();
z = LoadControl("~/UserControls/Z.ascx");
z.ID = "z1";
Controls.Add(z);

an error has occured:

"Control 'z_ResizableControlExtender1_ClientState' of type 'HiddenField'
must be placed inside a form tag with runat=server."

so what I'm doing wrong ?


.



Relevant Pages

  • RE: How to create a UserControl or Derived Panel to act like a con
    ... (involves source control integration issues). ... but with the designer extensions commented out. ... I have implemented a custom CodeDOMSerializer for the UserControl to get ... return baseClassSerializer.Deserialize(manager, codeObject); ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Seeking Help for Creating UserControl
    ... as is the case with a UserControl. ... specific Designer class. ... UserControl, however, as it is derived from ContainerControl, but allows you ... of my control as the client area, ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Really odd problem with inheritance
    ... Base.cs - This is a UserControl that inherits from Panel and uses ... Test.cs - This is a UserControl that implements Base.cs to draw the ... control, overrides OnPaint and has a get/set pointing to Background.cs. ... This totally screws up the redrawing in the designer as Background suddenly ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: UserControl as container
    ... I believe I can now create the specific control that I ask about. ... However, I can't create it by inheriting from UserControl, nor do I ... designer and framework design. ... Looking at GroupBox and Panel I see that one inherits from ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Really odd problem with inheritance
    ... Since your Base.cs wants to control the content of this field itself. ... Base.cs - This is a UserControl that inherits from Panel and uses ... Test.cs - This is a UserControl that implements Base.cs to draw the ... designer, basically i pass the Base.cs control to Background.cs so that i ...
    (microsoft.public.dotnet.framework.windowsforms.controls)