Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Cannot select checkboxes in checkboxlist within repeater.

Reply
Thread Tools

Cannot select checkboxes in checkboxlist within repeater.

 
 
Ratman
Guest
Posts: n/a
 
      06-29-2004
I have the following function that created a checkboxlist and "is
supposed" to be checking values that are already saved in the
database. As I step thru the code, it is in fact marking the
approporiate checkboxes as checked as I watch them in the watch windo
and I see the execution of the code go into the appropriate code
blocks. The problem is, the checkboxes are not being checked on th
UI. Any ideas here? This function is being called on the Item
created event of my repeater. My repeater contains a label, for the
category, and a checkboxlist, for the subcategories.

Private Sub cblSubCategoryDataBind(ByVal Item As RepeaterItem)

Dim lCategoryID As Integer = CType(CType(CType(Item.DataItem,
DataRowView).Row, DataRow)("CategoryID"), Integer)

Dim oSubCategoryID As CheckBoxList
oSubCategoryID = CType(Item.FindControl("cblSubCategoryID"),
CheckBoxList)

Dim oCategory As New GDCDB.category

oSubCategoryID.DataValueField = "SubCategoryID"
oSubCategoryID.DataTextField = "SubCategory"
oSubCategoryID.DataSource =
oCategory.GetAllSubCategoriesByCategoryID(lCategor yID)
oSubCategoryID.DataBind()

oCategory = Nothing

'go thru checkboxes for this category and check any that are
checked in the DB
Dim oPiece As New GDCDB.piece
oPiece.PieceID = CType(txtPieceID.Text, Integer)

Dim oDs As New DataSet
oDs = oPiece.SelectAllSubCategoriesByPieceID(lCategoryID )

Dim oDataRow As DataRow
Dim oLi As ListItem

For Each oDataRow In oDs.Tables(0).Rows

If Not (oDataRow.IsNull("Selected")) Then
oLi =
oSubCategoryID.Items.FindByValue(CType(oDataRow("S ubCategoryID"),
String))
oLi.Selected = True
Else
oLi =
oSubCategoryID.Items.FindByValue(CType(oDataRow("S ubCategoryID"),
String))
oLi.Selected = False
End If

Next

oLi = Nothing
oDataRow = Nothing
oDs = Nothing
oPiece = Nothing

End Sub

Help me please!

Thanks in advance.
 
Reply With Quote
 
 
 
 
Trevor Benedict R
Guest
Posts: n/a
 
      06-30-2004
If you have smartNavigation on then turn it off. Then close the browser
and navigate to the link again. Then do a View Source and see what is
wrong. You can post the code here.

Regards,

Trevor Benedict R
MCSD

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
 
Ratman
Guest
Posts: n/a
 
      07-04-2004
Actually, what I did was move my function call from the OnItemCreated
event to the OnItemDayaBound event of the repeater and now it works.
Thanks anyways.

JDA
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Bind to a checkboxlist - need some checkboxes checked hooterbite@yahoo.com ASP .Net 0 06-30-2006 10:19 AM
Help: Using Multiple Checkboxes or Checkboxlist to filter results in a gridview in ASP.NET 2.0 / VS2005 Faybert@gmail.com ASP .Net 0 12-29-2005 11:43 PM
Using Checkboxes Within the DataGrid Control to Select Records sianan ASP .Net 5 10-27-2005 01:25 AM
Is it possible to Add CheckBoxes within Select lists? Toboja Javascript 3 01-03-2005 06:15 PM
implement "select all" button to select all checkboxes Matt ASP General 2 01-11-2004 01:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57