473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Problem reseting CheckBoxList when not checked.

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
Nov 19 '05 #1
1 1470
Well fixed it by doing:-
print.Text =""

"Patrick.O.Ige" wrote:
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)
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bryce Budd | last post by:
Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community whose supported me when I've needed it. After all...
3
by: I am Sam | last post by:
I keep getting the following error message when I try to iterate through a CheckBoxList control: Object reference not set to an instance of an object. Description: An unhandled exception...
2
by: Patrick.O.Ige | last post by:
I have some boolean value(1 or 0 ) in a table and i want a databinded CheckBoxList to present the selected values on the page.. With CheckBox i know i can se the Checked property like so :-...
2
by: Patrick.O.Ige | last post by:
I have a Checkboxlist that is databinded and i want to pass it a boolean value from a table because i want to display the checked values if its TRUE. When Databinding my checkboxlist i'm not...
1
by: Lynn | last post by:
Hello, I have a page that allows the person to select multiple items from a checkboxlist. The checkboxlist is being populated from a table in the database. The user's selections are sent to the...
2
by: jase_rw | last post by:
Hi There, Having trouble with a CheckBoxList in VB.NET. I've a CheckBoxList on a webform. I read some data from a database and try and check the appropriate boxes based on the data....
14
by: Satheesh Babu B | last post by:
hai.. am having a checkboxlist..now how do i get the value of the checkbox that is checked in checkboxlist using javascript? Thanks in advance.... Regards,
2
by: Stimp | last post by:
I have a checkboxlist (chkMyList) which is created from a (name, value) pair from a database table. I have a read-only textbox which will be used to hold a total of all the numerical values of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.