Problem reseting CheckBoxList when not checked.

G

Guest

I have CheckboxList Databinded below and that works fine and i can get the
selected values after PostBack.
But what i have noticed is that when you select a checkbox i.e lets say 3 of
them and later unselect them the last one u unselect remains printed out on
the screen.
How can i reset Checkboxlists back to NULL.
I need to do this becos i'm passing the values to a QueryString and if the
unselect and remains in the queryString its a problem.
Any ideas?


<asp:checkboxlist id="chkList" AutoPostBack="True" Runat="server"
DataValueField="ProductFeatureID" DataTextField="Feature"
OnSelectedIndexChanged="Check_Clicked"></asp:checkboxlist></td>

Sub Check_Clicked(ByVal sender As Object, ByVal e As EventArgs)
'print.Text = "Selected Item(s):<br><br>"
Dim i As Integer
Dim a As String

Dim P As String = ""
For i = 0 To chkList.Items.Count - 1

If chkList.Items(i).Selected Then
P &= "," & chkList.Items(i).Value
print.Text = P
End If
Next
End Sub
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top