473,386 Members | 1,815 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,386 software developers and data experts.

ASP.NET 2.0 CheckboxList Question - VS 2005 RC1

I am using a checkbox list populated from a dataset table. The list has
about 24 items. In the SelectedIndexChanged event, the SelectedIndex of
the checkbox list always returns the lowest selected index of the list
instead of what I clicked on.
So if item 3 is checked and I check on item 10, the selected index of
the control is always 3. How can I get the index of what was selected?
The eventArgs is empty.
Can anyone help me please?
Curt

Nov 19 '05 #1
3 1058
Are you resetting the list in the Page_Load?

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Curt tabor" wrote:
I am using a checkbox list populated from a dataset table. The list has
about 24 items. In the SelectedIndexChanged event, the SelectedIndex of
the checkbox list always returns the lowest selected index of the list
instead of what I clicked on.
So if item 3 is checked and I check on item 10, the selected index of
the control is always 3. How can I get the index of what was selected?
The eventArgs is empty.
Can anyone help me please?
Curt

Nov 19 '05 #2
No, I load it in the page load but only if it's not a postback. Even
the online help says that SelectedIndex returns the lowest selected
index but in thier SelectedIndexChanged sample code, they use
SelectedIndex which will only retururn them the lowest selected item
index so thier own sample code looks like it will do what I;m seeing.
It would be nice if I could find out which checkbox was clicked. Do you
know how to do that?

Thanks for answering,

Curt

Nov 19 '05 #3
Will this [1] help?

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1] http://msmvps.com/simpleman/archive/.../24/59491.aspx
"Curt tabor" <ct****@oneil.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
No, I load it in the page load but only if it's not a postback. Even
the online help says that SelectedIndex returns the lowest selected
index but in thier SelectedIndexChanged sample code, they use
SelectedIndex which will only retururn them the lowest selected item
index so thier own sample code looks like it will do what I;m seeing.
It would be nice if I could find out which checkbox was clicked. Do you
know how to do that?

Thanks for answering,

Curt

Nov 19 '05 #4

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...
4
by: dm_dal | last post by:
Is there a know issue surrounding the CheckBoxList control and it's viewstate? When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected...
4
by: Shaul Feldman | last post by:
Hello, I have something really awkward at work - fighting with CheckBoxList... How can I define CSS for ListItem in CheckBoxList programmatically. I add CheckBoxList's Items on the fly, something...
5
by: Eirik Eldorsen | last post by:
I'm trying to code a reapter that for each listelement show a checkboxlist. I'm almost there. The only thing I can't figure out is how to set the ID of the checkboxlists. This is my code:...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
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: Gamlyn | last post by:
Can anyone please show me what the VB would look like to get CheckBoxList form results into a oMessage.Body for sending in email? This is an example of my CheckBoxList: <asp:CheckBoxList...
2
by: Bart Van Hemelen | last post by:
The situation: I have a CheckBoxList cblTest, the items are disabled in cblTest_DataBound in a foreach (ListItem oItem in cblTest.Items) loop. I provide a link that calls a client-side JavaScript...
6
by: Bishop | last post by:
I'm trying to find out how to populate a CheckBoxList from code without using a database. The following code generates 6 unchecked checkboxes without any text. Dim x As Integer For x = 0 To 5...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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.