PC Review


Reply
Thread Tools Rate Thread

Dynamic Checkbox.Check Problem

 
 
gwilliam
Guest
Posts: n/a
 
      25th Aug 2006
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
code:

strSQL = "usp_TradeShow_GetAllAttendeeClasses_Sel " &
lblHiddenUserID.Text & ", " & intSemSchedule
dsTempDataSet = wsMain.GetData(strSQL, strdBase, "TSAttendees")
tblAttendees.Rows.Clear()
'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
'chkList1.Items.Add(New
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")
'If
dsTempDataSet.Tables("TSAttendees").Rows(intCount).Item("SignUp") = 1
Then
'chkList1.Items(intCount).Selected = True
'Else
' chkList1.Items(intCount).Selected = False
'End If
If
dsTempDataSet.Tables("TSAttendees").Rows(intCount).Item("SignUp") = 1
Then
chkList1.Checked = True
Else
chkList1.Checked = False
End If
chkList1.Font.Name = "Verdana"
cAttendeeCell.Controls.Add(chkList1)
'chkList1.Font.Size = "9"
End With
rAttendeeRow.Cells.Add(cAttendeeCell)
tblAttendees.Rows.Add(rAttendeeRow)
Next

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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check whether user put a check in a toolbox CheckBox contro JB Microsoft ASP .NET 1 27th Aug 2009 12:18 AM
Dynamic Checkbox problem when added in render method &checked=true =?Utf-8?B?S2V2aW4gUg==?= Microsoft ASP .NET 1 5th Jul 2006 04:23 PM
Strange problem of Dynamic Checkbox savvy Microsoft ASP .NET 1 15th Nov 2005 12:40 PM
Order of events problem with dynamic checkbox. Please help! =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= Microsoft ASP .NET 0 17th Aug 2005 06:15 PM
Problem Changing the Checked Property of a dynamic checkbox Scott P. Microsoft ASP .NET 0 2nd Apr 2004 06:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:15 PM.