By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,596 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

Dynamic Checkbox.Check Problem

P: n/a
Problem with checkboxes in webpages. I am trying to re-set the values
of dinamically created checkboxes in a web page, but no matter what I
try the "Checked" property is not set correctly.
A control on the page does a PostBack which in turn calls the following

strSQL = "usp_TradeShow_GetAllAttendeeClasses_Sel " &
lblHiddenUserID.Text & ", " & intSemSchedule
dsTempDataSet = wsMain.GetData(strSQL, strdBase, "TSAttendees")
'Dim chkList1 As New CheckBoxList
For intCount = 0 To
dsTempDataSet.Tables("TSAttendees").Rows.Count - 1
Dim rAttendeeRow As New TableRow
Dim cAttendeeCell As New TableCell
With cAttendeeCell
ListItem(dsTempDataSet.Tables("TSAttendees").Rows( intCount).Item("Attendee"),
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("UserID")))
Dim chkList1 As New CheckBox
chkList1.Text =
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("Attendee")
chkList1.ID = "Chk" &
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("UserID")
chkList1.EnableViewState = False
'chkList1.Checked =
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("SignUp")
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("SignUp") = 1
'chkList1.Items(intCount).Selected = True
' chkList1.Items(intCount).Selected = False
'End If
dsTempDataSet.Tables("TSAttendees").Rows(intCount) .Item("SignUp") = 1
chkList1.Checked = True
chkList1.Checked = False
End If
chkList1.Font.Name = "Verdana"
'chkList1.Font.Size = "9"
End With

This code creates a checkbox control with the Checked value depending
on a database field, then places the control on a cell, then on a row
and finally it adds it to the table. The first time around it is
perfect, how ever any postback after that does not re-set the
checkbox.checked value. I have followed to code and notice that the
correct values are being set, however the page renders incorrect.

Any help would be greatly appreciated

Aug 25 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.