Forums
This topic is locked
asp.net / Loosing index of dropDownList on autopos
17 Aug 2005 19:49:41 Mike M posted:
Hi all,I'm having trouble accomplishing a task in ASP.NET / C# and was hoping for some help.
I have an asp:dropdownlist, being dynamically generated from a DataSet [hitting a SQL Server] set to AutoPostBack.
The problem is that when the autopostback occurs the dropdownlist resets itself to the first index of the list.
So, in other words, if I have a drop down list with three items: Red, Yellow, and Blue
Every time I select my choice...say Blue...it does the autopost back, and I can grab the SelectedIndex [which is perfect for my backend stuff], but then the postedback page shows 'Red' again, and the user feels like nothing actually happened.
If I was to create the list items for the drop down manually, then this error does not occur. It ONLY occurs because the dropdownlist is being dynamically generated.
I have tried to grabbing the selectedIndex using Request.Form, but I don't know how to assign the drop down that SelectedIndex on the postback as it is being generated...
Does anyone have any suggestions or a solution? I would greatly appreciate it.
Thank you VERY much
-Mike
Replies
Replied 24 Aug 2005 16:16:03
24 Aug 2005 16:16:03 Vince Baker replied:
Hi Mike,
You may have more success posting this in the dedicated asp.net forums rather than the .asp forums.
Try this link: www.dnzone.com
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
You may have more success posting this in the dedicated asp.net forums rather than the .asp forums.
Try this link: www.dnzone.com
Regards
Vince Baker
<strong>DMX Zone Manager</strong>
[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]