473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Cannot select checkboxes in checkboxlist within repeater.

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.
Nov 18 '05 #1
2 2264
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!
Nov 18 '05 #2
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
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tony | last post by:
I have a repeater that renders multiple checkboxlists that are set up with a repeat direction of horizontal. Because the labels for each checkbox are different in length only the individual...
2
by: john | last post by:
I posted this question to comp.lang.javascript but didn't get a response, so I'll try here. I am using ASP.NET and I have a datagrid. One of the columns in my grid is all checkboxes. When the...
3
by: JD | last post by:
Hello, I have a problem with checkboxlist inside Repeater (in ASP.NET page). I am able to create Checkboxlist and bind it (inside Repeater_ItemBound - including setting checked/unchecked)....
5
by: Eirik Eldorsen | last post by:
I'm trying to code a reapter that for each listelement show a checkboxlist. I'm almost there. The only thing I can't figure out is how to set the ID of the checkboxlists. This is my code:...
2
by: George Durzi | last post by:
This is more of a design/philosophical question :) I have a page in which the user sets attributes for a project. There are 8 attributes, e.g. Project Type, Country, etc. The number of options...
4
by: Roy | last post by:
Hey all, I have a "worker" page where users can click on checkboxes, fill in notes, etc. I wish to "pre-check" the checkboxes if certain criteria are met. I assume it must be done in the For loop...
1
by: SalamElias | last post by:
When I add checkboxes dynamically, I can set several attributes(id, eventhandlers specific to checkboxes....) in code. I decided to use the checkboxlist to generate several checkboxes dynamically...
2
by: bissatch | last post by:
Hi, I am trying to output a list of checkboxes. Using ASP .NET controls, I was able to create the following: <label for="colour_red">Red: </label><asp:CheckBox ID="colour_red" runat="server"...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.