Results 1 to 3 of 3

Thread: dynamic controls

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    dynamic controls

    I need to try to create some ASP.NET server side controls dynamically at runtime. I know I can do this using placeholder controls, but what I am doing is writing out an html table via code. In one of the fields in this HTML table will be checkboxes. I want them to be ASP.NET checkboxes so I can use them in the codebehind.

    Since the amount of records written out to this table is dynamic, infact the entire table is dynamic, there is no way for me to put placeholders and design time.

    what method can I use to accomplish this?

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: dynamic controls

    If you are creating the HTML table programmically then you can add the new control to the ControlCollection for the TableCell.

    Code:
    TableCell contextCell = new TableCell();
    contextCell.Width = 24;
    
    Image contextImage = new Image();
    contextImage.ImageUrl = "/images/explore.gif";
    contextCell.Controls.Add( contextImage );
    Give a shout if you have any problems.

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: dynamic controls

    What about a repeater control? It can be surrounded by your table tags and can repeat for whatever amount of times for your checkboxes.

Posting Permissions

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



Click Here to Expand Forum to Full Width