|
-
Jun 28th, 2007, 08:00 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] After submission, the value from the Listbox is incorrect.
I have this code inside of my button's event. The problem I am having is that the text input into the database is always the text from the first index of the listbox named categoryLst. I even used a listbox selection change event to change the text whenever the listbox was changed. But that became a lot more code and it still didn't work. I still get whatever is first in the list. I don't understand why this is happening. I am thinking it's a timing issue of some kind.
Code:
comm.Parameters.Add("@Relation", System.Data.SqlDbType.NVarChar, 20);
comm.Parameters["@Relation"].Value = categoryLst.SelectedItem.Text;
I need some help figuring out how I can get the text from the selection made, not the first one in the list. It's stuck and not changing for me when processing code. The user can change the selection in the list box and then hit the submit button. What is going on?
-
Jun 30th, 2007, 08:27 AM
#2
Re: After submission, the value from the Listbox is incorrect.
You need to show more code for the part of submit button click
-
Jun 30th, 2007, 08:29 AM
#3
Re: After submission, the value from the Listbox is incorrect.
Can you show the code of the submit button?
EDIT: Oops, too late.
-
Jun 30th, 2007, 10:26 AM
#4
Thread Starter
Hyperactive Member
Re: After submission, the value from the Listbox is incorrect.
Using Page.IsPostBack solves the problem of accidentally rebinding the data and setting the list box back to it's default index.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|