Listbox Dropdownlist SelectedIndex resets after postback. [modified]
-
Hi all guys, I am trying to get the index of the listbox, after I selected RadioButton that has Autopostback=true. Here is some code..... string titleColor = this.titleColorList.Items[this.titleColorList.SelectedIndex].Text; And then I tried to show the result: Transparent The Transparent is the first member of list or it has index=0 It took me for hours :( still don't know how to get it work. Anybody know how to resolve this problem? Any help would be appreciated. Thank you very much. -- modified at 6:02 Friday 15th June, 2007
junior boy
-
Hi all guys, I am trying to get the index of the listbox, after I selected RadioButton that has Autopostback=true. Here is some code..... string titleColor = this.titleColorList.Items[this.titleColorList.SelectedIndex].Text; And then I tried to show the result: Transparent The Transparent is the first member of list or it has index=0 It took me for hours :( still don't know how to get it work. Anybody know how to resolve this problem? Any help would be appreciated. Thank you very much. -- modified at 6:02 Friday 15th June, 2007
junior boy
-
set EnableViewState of your dropdownlist to true, it will save the value after the page load. If it is not what you need, I did not well understood
The listbox dropdownlist still keep and showing what member I selected after postback but when I tried to show what exactly selectedIndex is, it shows me the first index, it wasn't the index of the selected value. Regard,
junior boy
-
The listbox dropdownlist still keep and showing what member I selected after postback but when I tried to show what exactly selectedIndex is, it shows me the first index, it wasn't the index of the selected value. Regard,
junior boy
-
The listbox dropdownlist still keep and showing what member I selected after postback but when I tried to show what exactly selectedIndex is, it shows me the first index, it wasn't the index of the selected value. Regard,
junior boy
Hi, Try this In page load try to use if(!page.Ispostback) and inside it try to keep the your code ...it may work.....
Goutham
-
Hi, Try this In page load try to use if(!page.Ispostback) and inside it try to keep the your code ...it may work.....
Goutham
Thank you very sir, Not I got it worked:) Actually I have tried to use SelecteValue but I didn't get it work somehow but now I tried it again and it work well. Thank you very much and really appreciated.
junior boy
-
Hi all guys, I am trying to get the index of the listbox, after I selected RadioButton that has Autopostback=true. Here is some code..... string titleColor = this.titleColorList.Items[this.titleColorList.SelectedIndex].Text; And then I tried to show the result: Transparent The Transparent is the first member of list or it has index=0 It took me for hours :( still don't know how to get it work. Anybody know how to resolve this problem? Any help would be appreciated. Thank you very much. -- modified at 6:02 Friday 15th June, 2007
junior boy
It looks like the dropdownlist is getting rebound in Page_Load even on Postback. Can you check whether you could bypass this by using IsPostback property so that the control is resurrected of its values from the ViewState statebag?
Vasudevan Deepak Kumar Personal Homepage Tech Gossips