Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > problems with assigning specified indexes to checkboxlists

Thread Tools

problems with assigning specified indexes to checkboxlists

Mike Rogers
Posts: n/a
I am populating a checkboxlist:

Up to now I did this:
chkItem.DataSource = objDatareader
chkItem.DataTextField = "item_name"
chkItem.DataValueField = "item_ID_PK"

but I can't add or string more than one field like this to the
datatextfield: (i need more information displayed!)

chkItem.DataTextField = "item_name" & " " & "item_desc"

How can I get around this?

I tried doing this:

Private Sub Page_Init(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
Dim cbl As New CheckBoxList()
cbl.ID = "cblist1"
cbl.Items.Add(datareader("name") & " " & datareader("Desc"))

I will modify this using a list to read a dataareader in a loop and
assign a field name as the cbl.items...

but I dont want these assigned as 1, 2, : i want them as the
item_ID_PK field from the datareader. How do I assign the "index???"

Does anyone have any suggestions for either of these approches?
thanks and kind regards,
Reply With Quote

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
dynamically generate checkboxlists (ASP .net 2.0 w/ C#) KBuser ASP .Net 1 04-11-2006 12:35 PM
Validation of CheckBoxLists Michael Groeger ASP .Net 3 09-29-2005 03:53 PM
automatically assigning names to indexes Python 8 07-13-2005 03:28 PM
Client side code for two checkboxlists =?Utf-8?B?U2FuZHk=?= ASP .Net 2 06-09-2005 01:11 AM
DropDownLists, ListBoxs, and CheckBoxLists Pranav Shah ASP .Net Web Controls 1 07-25-2003 08:51 AM