problems with assigning specified indexes to checkboxlists

Discussion in 'ASP .Net Web Controls' started by Mike Rogers, Aug 9, 2003.

  1. Mike Rogers

    Mike Rogers Guest

    I am populating a checkboxlist:

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

    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.
    InitializeComponent()
    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,
    Mike
     
    Mike Rogers, Aug 9, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FuZHk=?=

    Client side code for two checkboxlists

    =?Utf-8?B?U2FuZHk=?=, Jun 8, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    482
    =?Utf-8?B?U2FuZHk=?=
    Jun 9, 2005
  2. Michael Groeger

    Validation of CheckBoxLists

    Michael Groeger, Sep 29, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    503
    S. Justin Gengo
    Sep 29, 2005
  3. KBuser
    Replies:
    1
    Views:
    844
    Brian
    Apr 11, 2006
  4. Replies:
    8
    Views:
    312
    Skip Montanaro
    Jul 13, 2005
  5. Pranav Shah

    DropDownLists, ListBoxs, and CheckBoxLists

    Pranav Shah, Jul 25, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    119
    Ravikanth[MVP]
    Jul 25, 2003
Loading...

Share This Page