Results 1 to 5 of 5

Thread: Dynamic generation of CheckBoxes

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2004
    Location
    India
    Posts
    53

    Dynamic generation of CheckBoxes

    Hi everyone

    I am trying to generate Checkboxes at runtime...its basically a order form, where number of checkboxes will depend on number of items in the form..and the items will be picked from database.

    i dont know if thats right...but i tried using Controls.Add( New Checkbox)...i could solve the issue with this.

    Can anyone kindly help me out.

    regds

    yash.
    Yash

  2. #2
    Member EricDalnas's Avatar
    Join Date
    Sep 2004
    Location
    Rhode Island
    Posts
    51
    When I dynamically add controls, usually I use a htmltable as a container and add a new row and cell and then add the control to that cells control collection.
    Maybe if you'd stop breathing and die for a change I wouldn't be so pissed off all the time.

    www.mredkj.com

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 2004
    Location
    India
    Posts
    53
    .may you please send me the code for generating the checkboxes dynamically..
    Yash

  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2004
    Location
    India
    Posts
    53
    still waiting for a response from anyone...

    i m trying to generate checkboxes dynamically through COdeBehind...is this possible...plz reply
    Yash

  5. #5
    Member EricDalnas's Avatar
    Join Date
    Sep 2004
    Location
    Rhode Island
    Posts
    51
    This is the basics of it.

    'create Table Row
    Dim htmlRow As New system.Web.UI.HtmlControls.HtmlTableRow
    htmlRow.ID = "UniqueID"

    'create Table Cell
    Dim htmlcell As New System.Web.UI.HtmlControls.HtmlTableCell
    htmlcell.Align = "left"

    'Create CheckBox
    Dim chk As New System.Web.UI.WebControls.CheckBox
    chk.ID = "UniqueCheckBoxID"

    'add checkbox to cell and then the cell to the row
    htmlcell.Controls.Add(chk)
    htmlRow.Controls.Add(htmlcell)

    'find the table to add to
    htmlTable = Me.FindControl("TABLEName")

    'add row to table
    htmlTable.Controls.Add(htmlRow)
    Maybe if you'd stop breathing and die for a change I wouldn't be so pissed off all the time.

    www.mredkj.com

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