By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,949 Members | 921 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,949 IT Pros & Developers. It's quick & easy.

EnableViewState not being set to false

P: n/a
I want to post a form and not have the form maintain it's value. I am have tried setting EnableViewState = False at the control and on Page Load. When I submit the button my selection is returned. What am I missin

Mik
<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 115px; POSITION: absolute; TOP: 163px" runat="server" Width="154px" Height="67px" EnableViewState="False"><asp:ListItem>Item 1</asp:ListItem><asp:ListItem>Item 2</asp:ListItem><asp:ListItem>Item 3</asp:ListItem><asp:ListItem>Item 4</asp:ListItem></asp:DropDownList>
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
CT
Is this your problem?
http://support.microsoft.com/default...;EN-US;Q316813

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
"Mike Drewery" <an*******@discussions.microsoft.com> wrote in message
news:3C**********************************@microsof t.com...
I want to post a form and not have the form maintain it's value. I am have
tried setting EnableViewState = False at the control and on Page Load.
When I submit the button my selection is returned. What am I missing
Mike

<asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 115px;
POSITION: absolute; TOP: 163px" runat="server" Width="154px" Height="67px"
EnableViewState="False"><asp:ListItem>Item
1</asp:ListItem><asp:ListItem>Item 2</asp:ListItem><asp:ListItem>Item
3</asp:ListItem><asp:ListItem>Item 4</asp:ListItem></asp:DropDownList>

Nov 18 '05 #2

P: n/a
That's not it. I am not using the controls listed. I was using a listbox. If I don't set it to run at server then it works fine. Is this by design? I am new to dotnet and I am trying to get a handle on when to use what controls

Thanks for your reply

Mike
Nov 18 '05 #3

P: n/a
Hi,

in fact it is, ListBox just isn't listed because it uses both 'worlds' in
fact. It stores all items to ViewState, but posts the selection along with
the form (despite do you have ViewState enabled or not).

To reset the selection, you need to set SelectedIndex manually to -1 or call
ClearSelection() method of ListBox.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Mike Drewery" <an*******@discussions.microsoft.com> wrote in message
news:D5**********************************@microsof t.com...
That's not it. I am not using the controls listed. I was using a listbox. If I don't set it to run at server then it works fine. Is this by
design? I am new to dotnet and I am trying to get a handle on when to use
what controls.
Thanks for your reply

Mike

Nov 18 '05 #4

P: n/a
This doesn't clear it

DropDownList1.ClearSelection(
DropDownList1.SelectedIndex = (-1

in page on load

Thank
Mike
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.