DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 09 Aug 2007 04:31:11 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Chris Peeters
          2    Eliyahu Goldin


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 ***
Date:Thu, 09 Aug 2007 04:31:11 -0700   Author:  

Re: EnableViewState strange behaviour ???   

> 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
Date:Thu, 9 Aug 2007 15:37:24 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us