|
-
Feb 9th, 2005, 03:00 AM
#1
Thread Starter
Fanatic Member
clearing viewstate for individual controls
I have a listbox thats databound, the data behind will chnage depending on the results of other listboxes.
The probem is I have set enabledviewstae = true and if you select a value and on the next data pull this value isnt included then i get the error
"Specified argument was out of the range of valid values."
I need to know how to clear the viewstate for this one control before databinding
-
Feb 9th, 2005, 08:47 AM
#2
Retired VBF Adm1nistrator
Re: clearing viewstate for individual controls
Why don't you just rebind the control?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Feb 9th, 2005, 08:55 AM
#3
Thread Starter
Fanatic Member
Re: clearing viewstate for individual controls
I am doing but heres an example of the problem:
dropdown is bound and user selects an option "Yellow"
Yellow is then stored in the viewstate for this control.
Things happen on the page and controls gets bound to a different version of the data that doesnt include "Yellow"
.NET then trys to set the controls selected item to "Yellow" as this is stored in viewstate and is erroring as "Yellow" no longer exists
-
Feb 9th, 2005, 09:10 AM
#4
Retired VBF Adm1nistrator
Re: clearing viewstate for individual controls
So even if you did something like this:
VB Code:
'' somewhere in code
''
drpMyDropDownList.DataSource = dtaSomeDataSet
drpMyDropDownList.Bind()
Otherwise, is EnableViewState a read only property at runtime or could you change it to False and then back to True and perhaps that might clear it?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
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
|