P
Patrick.O.Ige
I'm DataBinding a CheckBoxList and i want to get the checkboxes selected
when the page is loaded depending on a Boolean value from the Database..
chkDebtor.DataSource = objDR
chkDebtor.DataValueField = "checked" -- this is a column in the
table that returns 1 or 0
chkDebtor.DataTextField = "DebtorCode"
chkDebtor.DataBind()
Dim i As Integer = 0
While i < chkDebtor.Items.Count
chkDebtor.Items(i).Selected =
Microsoft.VisualBasic.IIf((chkDebtor.Items(i).Value = "1"), True, False)
System.Math.Min(System.Threading.Interlocked.Increment(i),
i - 1)
End While
The above code works
But i have some problems I need another DataValueField which is
"DebtorCodeID" but since i need the boolean value i used
the chkDebtor.DataValueField = "checked"
I need the "DebtorCodeID" later in my code.
My question is what other ways can i loop through the checkblxlist without
setting the DataValueField = "checked" but to
DataValueField = "DebtorCodeID"
Is there a way to get the Checked boolean values and pass it to the
checkboxlist to get False or TRUE?
when the page is loaded depending on a Boolean value from the Database..
chkDebtor.DataSource = objDR
chkDebtor.DataValueField = "checked" -- this is a column in the
table that returns 1 or 0
chkDebtor.DataTextField = "DebtorCode"
chkDebtor.DataBind()
Dim i As Integer = 0
While i < chkDebtor.Items.Count
chkDebtor.Items(i).Selected =
Microsoft.VisualBasic.IIf((chkDebtor.Items(i).Value = "1"), True, False)
System.Math.Min(System.Threading.Interlocked.Increment(i),
i - 1)
End While
The above code works
But i have some problems I need another DataValueField which is
"DebtorCodeID" but since i need the boolean value i used
the chkDebtor.DataValueField = "checked"
I need the "DebtorCodeID" later in my code.
My question is what other ways can i loop through the checkblxlist without
setting the DataValueField = "checked" but to
DataValueField = "DebtorCodeID"
Is there a way to get the Checked boolean values and pass it to the
checkboxlist to get False or TRUE?