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

ListBox - Can't get SelectedIndex

Hello,

I have a listbox, where upon clicking a button I want to edit the page
associated with the item selected from the list box. I have it check
for listboxname.SelectedIndex > -1 for which it keeps coming back false
even though I have selected something in the list. This used to work
on this page, but I can't find what I did to break it. Is there some
common cause that would keep the selectedindex from being set? I've
run into this before, but can't remember how I solved the problem.

Thanks for any help.

Regards,

Doug Dossett

Nov 16 '05 #1
7 1698
is the EnableViewState property set to true?

<do**********@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hello,

I have a listbox, where upon clicking a button I want to edit the page
associated with the item selected from the list box. I have it check
for listboxname.SelectedIndex > -1 for which it keeps coming back false
even though I have selected something in the list. This used to work
on this page, but I can't find what I did to break it. Is there some
common cause that would keep the selectedindex from being set? I've
run into this before, but can't remember how I solved the problem.

Thanks for any help.

Regards,

Doug Dossett

Nov 16 '05 #2
Yes, that was one of my first thoughts, didn't seem to make a
difference.

Thanks,

Doug

Nov 16 '05 #3
try removing the list and adding a new one, that could solve it

<do**********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Yes, that was one of my first thoughts, didn't seem to make a
difference.

Thanks,

Doug

Nov 16 '05 #4
Nope, no change.

Nov 16 '05 #5
are you databinding the list? that could be the reason for losing the
viewstate info.
<do**********@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
Nope, no change.

Nov 16 '05 #6
Yes, but not on postback. It used to work this way, so I don't think
that has anything to do with it. Thanks for your ideas!

Nov 16 '05 #7
you r welcome. sorry that I already ran out of ideas ;-). hope you find the
solution.
alejandro.

<do**********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Yes, but not on postback. It used to work this way, so I don't think
that has anything to do with it. Thanks for your ideas!

Nov 16 '05 #8

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

Similar topics

2
by: David Ichilov | last post by:
I've class derived from "Object" class, with ToString() method overriden itc. , now i add object of this class to Windows.Forms.ListBox.Items collection, and it works fine, displaying what...
6
by: Adam Klobukowski | last post by:
Hello. /windows forms/ I'm marking listbox items as selected, and I'd like to scroll listbox to a selected entry if it is off-screen. How can I do it? -- Semper Fidelis Adam Klobukowski
1
by: jez123456 | last post by:
Hi, I have a windows form with a listbox control. My code all works correctly when deleting an item from the listbox except the last item. I get the following message when trying to delete the...
3
by: Joey | last post by:
Hi, I'm trying to add a default item to my listbox but when I do it tells me that it's not defined, could someone tell me the syntax I need to use to get the listbox control to display a default...
5
by: Lie | last post by:
Hi all, I have problem in getting selectedindex of multiple listbox selection in a datagrid. I have a listbox with multiple selection mode inside datagrid. In Edit mode, I need to get back all...
6
by: David De Cotis | last post by:
Hello all, I am trying to go through a ListBox and verify if am item was selected. If an item was selected, I would like to get a handle of the item and simply do a response.write on the selected...
21
by: Bilal Abbasi | last post by:
I realize that you can add items to a list box as objects so you can have access to more than just one property like the itemindex in vb6. Question I have is how do I cause the listbox to show a...
7
by: Dave | last post by:
Hi all, After unsuccessfully trying to make my own dual listbox control out of arraylists, I decided to look for a 3rd party control. I've looked for over a week now and can't find anything but...
5
by: Academia | last post by:
(If you've seen this in the drawing NG, sorry. I inadvertently sent it there.) I have a listbox populated with Objects. The Class has a String field that ToString returns. I assume that...
2
by: erbear | last post by:
Hi all, I am new to VB, and I am having some troubles. I have a listbox that when you click on the item it displays a picture in a picture box and a message in a label. It works fine when an item...
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: 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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.