Adding UC via Code

Discussion in 'ASP .Net Web Controls' started by Larry R, Jul 6, 2007.

  1. Larry R

    Larry R Guest

    I have a page that dynamically generates various controls and places
    them on a page. One of the controls is a UserControl .

    I have a static class that I use for creating TableRows, which I add
    to a Table at run time. The other controls such as a DropDownList and
    TextBox work, but I can't get the usercontrol to work.

    No errors, just nothing in the page.

    Any Ideas?

    THanks!


    public static TableRow
    CreateDateRange(System.Web.UI.UserControl control )
    {
    TableRow row = new TableRow();
    row.Cells.Add(new TableCell());
    row.Cells[0].Controls.Add(control);
    return row;

    }
     
    Larry R, Jul 6, 2007
    #1
    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. RN
    Replies:
    1
    Views:
    422
  2. Gerry Hickman
    Replies:
    2
    Views:
    1,515
    Gerry Hickman
    Dec 14, 2005
  3. Bart Van Hemelen

    Adding WebParts via code behind?

    Bart Van Hemelen, Sep 4, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,770
    Serious Black
    Jan 19, 2010
  4. Replies:
    3
    Views:
    764
    Chris Dollin
    Aug 31, 2005
  5. Replies:
    3
    Views:
    470
Loading...

Share This Page