Adding CheckBoxLists Dynamically

Results 1 to 2 of 2

Thread: Adding CheckBoxLists Dynamically

  1. #1
    Join Date
    Dec 1969

    Default Adding CheckBoxLists Dynamically

    I would like to add a checkboxlist to a form for each record in one table, and then add a checkbox to that list based on the number of records in another table that relate to the record in the first one. <BR><BR>In other words, I would like to add a varying number of checkboxlists and checkboxes depending on a user&#039;s choice. Does anyone know of a good tutorial on how to do this? <BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: Adding CheckBoxLists Dynamically

    Well the second part is easy, just data bind your CheckBoxList to the table.<BR><BR>&#060;asp:checkboxlist ID="myList" runat="server"<BR>DataTextField="myText"<BR>DataVa lueField="myID" /&#062;<BR><BR>As for the first part, you can create any number of controls programatically. I would probably run a For/Next up through the number of records that you want to create the control for and it&#039;d be easy to name them incrementally that way.<BR><BR>If you&#039;re unsure of how to do this then I suggest starting with the easier part, get one CheckBoxList up and running. Then search here for creating controls programatically on the fly.

Posting Permissions

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