Getting the value from a dropdownlist [Abandoned]
Here's the scenario. I have page with a dropdownlist on it. In the save button's click event, I am retrieving the value like this:
VB Code:
strDesig = Me.listDesignation.Items(Me.listDesignation.SelectedIndex).Value
Now this works.
However, when I set the EnableViewState property of the page to false, the code errors out at the above line, showing me that .SelectedIndex is -1.
This is despite the control's EnableViewState property being set to True.
Any clues?
Re: Getting the value from a dropdownlist
I ain't 100% sure but check the HTML source code to make sure there is a viewstate hidden form input. I'm not sure if turning off viewstate for the page forces viewstate not to work for everything?
DJ
Re: Getting the value from a dropdownlist
About to leave now, I'll look at your answer later. Thanks for replying though.
Re: Getting the value from a dropdownlist
DropDownList.AutoPostBack = True; ?
Re: Getting the value from a dropdownlist
This problem has been abandoned, thanks for replying though. :)
Re: Getting the value from a dropdownlist [Abandoned]
Quote:
This problem has been abandoned
That is a bad attitude....never abondon problems. Solve it...
Sorry....Just had to get you back!! :bigyello:
Re: Getting the value from a dropdownlist [Abandoned]
It somehow solved itself, so I abandoned it. I'm now tearing my hair out over the IE treeview control. A post to come on it soon, perhaps...
Re: Getting the value from a dropdownlist [Abandoned]
Hi,
Not that I'm ANY expert on that (IE TreeView), but let me know if you get stuck.
Reason I say so is that now I'm testing this WebControl Treeview (at MS) that is nearly the same as the IE webcontrols and I would lke to hear where ppl get stuck.
Re: Getting the value from a dropdownlist [Abandoned]
That's great! I'll start a new thread when I get into work, and PM you.