473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

EnableViewState strange behaviour ???

Hi,

I have a listBox listed with colornames and a panelcontrol that takes
the color of selecteditem from the listbox whenever I click a different
item:

protected void lstColors_SelectedIndexChanged(object sender, EventArgs
e)
{
pnlColor.BackColor =
Color.FromName(lstColors.SelectedItem.Value);
}

The panelcontrol draws correctly whenever I click in the listbox but
when I click on another button on the webform the panelcontrol looses
its color although EnableViewState is set to true for the panelcontrol.

Its only when I set the EnableViewState of the listBox to false that the
panelcontrol keeps its state (no matter what the EnableViewState of the
panelcontrol is set to) ???

how do you explain this strange behavior ?

thank you
Chris

*** Sent via Developersdex http://www.developersdex.com ***
Aug 9 '07 #1
1 1193
The panelcontrol draws correctly whenever I click in the listbox but
when I click on another button on the webform the panelcontrol looses
its color although EnableViewState is set to true for the panelcontrol.
Do you set the panel in some initial color in the Page_Load event? Do you
check IsPostBack property before doing that?
Its only when I set the EnableViewState of the listBox to false that the
panelcontrol keeps its state (no matter what the EnableViewState of the
panelcontrol is set to) ???
Setting EnableViewState to false disables firing events. Check if you have
any event handling code that could cause this behavior.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
Aug 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Drummond | last post by:
Hi all, I am developing software for Linux Redhat9 and I have noticed some very strange behaviour when throwing exceptions within a shared library. All our exceptions are derived from...
3
by: Sebastian C. | last post by:
Hello everybody Since I upgraded my Office XP Professional to SP3 I got strange behaviour. Pieces of code which works for 3 years now are suddenly stop to work properly. I have Office XP...
9
by: kai | last post by:
Hi, All I create an ASP.NET page, it contains FirstName textbox and LastName textbox. I setup "enableViewState=false" in page directive. When I enter data in FirstName and LastName textbox,...
7
by: Max Metral | last post by:
I have a Web.config in my application root dir with the following pages directive: <pages buffer="true" enableViewState="false" enableSessionState="false" enableViewStateMac="false"/> And...
2
by: michele | last post by:
Hi, i'm using a datagrid control in my webform, with AutoGenerateColumns=false; it work very well if EnableViewState=true; including paging and sorting, but this cause a big performance issue, so...
6
by: AFN | last post by:
I have a server-side table, <asp:table id="tblData" EnableViewState="true" runat="server" /> and my code-behind adds rows of data to the table in code that says: if not page.ispostback then...
7
by: Just D. | last post by:
Does anybody know any good solution to avoid this setting to be enabled? I guess Microsoft doesn't care of the Internet connection of the potential client working with asp.net. This EnableViewState...
3
by: | last post by:
Here is an interesting one. If I disable viewstate in the web.config file, but enable it on a specific page, it doesnt save the viewstate on postbacks. I have to actually enable it in web.config. ...
8
by: Dox33 | last post by:
I ran into a very strange behaviour of raw_input(). I hope somebody can tell me how to fix this. (Or is this a problem in the python source?) I will explain the problem by using 3 examples....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.