creating asp.net controls dynamically RRS feed

  • Question

  • Hi friends

    am new to asp.net ., i want to create asp.net controls dynamically from codebehind file.

    i tried the following:

    Gridview gv=new Gridview();





    am getting error as runat=server related issue.

    how can i set runat=server attribute from codebehind.

    any help appriciated.



    • Moved by Jie Bao Wednesday, April 25, 2012 6:07 AM (From:Windows Presentation Foundation (WPF))
    Sunday, April 22, 2012 3:19 PM

All replies

  • You need to add any new control to an existing container as explained in msdn


    This is a wpf forum rather than asp.net and you probably want to find somewhere more appropriate for any further questions.

    Sunday, April 22, 2012 4:19 PM
  • Hi Friend511,

    For ASP.NET questions, we have a dedicated ASP.NET forum. You can access it from this link: http://forums.asp.net/24.aspx/1?Web+Forms+Data+Controls

    Have a nice day,

    Kee Poppy [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 23, 2012 7:58 AM