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: Fri, 8 Jun 2007 08:59:01 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.buildingcontrols        back       

Thread Index
  1    Mark am
          2    (Walter Wang [MSFT])
                 3    Mark am
                        4    (Walter Wang [MSFT])


View State Null In IPostBackHandler   
Hi,

I had a datetimepicker server control that worked great in 1.x but I am 
having trouble with it in ASP.NET 2.x  For some reason, the ViewState value 
is always null on postback so IPostBackDataHandler.LoadPostData is unable to 
access the properties correctly.  Is there a change I should make?  Here's 
the iPostBackHandler code:

		void IPostBackDataHandler.RaisePostDataChangedEvent() {
			//OnSelectedIndexChanged(System.EventArgs.Empty);
			OnDateChanged(System.EventArgs.Empty);
		}

		bool IPostBackDataHandler.LoadPostData(string postDataKey, 
System.Collections.Specialized.NameValueCollection postCollection) {

// when it access the SelectedDate here, its ViewState value is null

			DateTime PreviousSelectedDate = SelectedDate;
			DateTime DateSubmitted = SelectedDate;

// other code

}

The code for the SelectedDate property is

		[
		Description("Gets or sets the date for the DateTimePicker control."),
		Category("Appearance"),
		//DefaultValue(),
		Bindable(true),
		]
		public virtual DateTime SelectedDate 
		{
			get 
			{
				object savedSelectedDate;

				savedSelectedDate = this.ViewState["SelectedDate"];
				if (savedSelectedDate != null)
					return (DateTime) savedSelectedDate;
				return DateTimeNotSet;
			}
			set 
			{
				this.ViewState["SelectedDate"] = value;
			}

		}


I've checked and EnabledViewState is not set to false on the page or 
controls.  Any suggestions?

-- 
Sincerely,

Mark Fox
Date:Fri, 8 Jun 2007 08:59:01 -0700   Author:  

RE: View State Null In IPostBackHandler   
Hi Mark,

I'm not aware of the IPostbackDataHandler has changed much in 2.0.

I also tried the code examples of book "Developing Microsoft? ASP.NET 
Server Controls and Components" here 
http://www.microsoft.com/mspress/books/companion/5728.aspx which was 
previously built with VS2002. The SimpleTextBox which demonstrates 
IPostBackDataHandler works fine in VS2005.

Please post more of your control's code to see if it's related to its 
implementation. Thanks.


Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Mon, 11 Jun 2007 08:11:10 GMT   Author:  

RE: View State Null In IPostBackHandler   
Hi Walter,

Thank you for your response!  You are correct that IPostBackHandler wasn't 
changed in ASP.NET 2.0.  After looking at this more I found that the problem 
was caused by a deep bug somewhere else.  I am sorry for the inconvenience 
and thank you for your help!

-- 
Sincerely,

Mark Fox


"Walter Wang [MSFT]" wrote:


> Hi Mark,
> 
> I'm not aware of the IPostbackDataHandler has changed much in 2.0.
> 
> I also tried the code examples of book "Developing Microsoft? ASP.NET 
> Server Controls and Components" here 
> http://www.microsoft.com/mspress/books/companion/5728.aspx which was 
> previously built with VS2002. The SimpleTextBox which demonstrates 
> IPostBackDataHandler works fine in VS2005.
> 
> Please post more of your control's code to see if it's related to its 
> implementation. Thanks.
> 
> 
> Regards,
> Walter Wang (wawang@online.microsoft.com, remove 'online.')
> Microsoft Online Community Support
> 
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
> 
> This posting is provided "AS IS" with no warranties, and confers no rights. 
> 
> 
Date:Mon, 11 Jun 2007 11:44:03 -0700   Author:  

RE: View State Null In IPostBackHandler   
Hi Mark,

You're welcome. I'm glad to know that you've solved the issue.

Have a nice day!

Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Tue, 12 Jun 2007 03:25:32 GMT   Author:  

Google
 
Web dotnetnewsgroup.com


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