M
Mike Rogers
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
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