472,145 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Error while using 'ControlState' property in my custom control

My name is Pavan and I am a software engineer working on ASP .Net web

Currently I am using .Net 2.0 Professional Edition to develop my web pages.

I have a problem

I have created custom calendar control, that will display dates between
given date range (By default from DateTime.MinValue to DateTime.MaxValue)

The main properties for this control is:

1. MinDate

2. Max Date and

3. SelectedDate

I need to retain their values across postbacks.

Initially I have used ViewState bag to do so, but turning off the ViewState
breaks my control.
I came to know that, we can use ‘ControlState’ property instead.

I have done the same, and it worked fine.

After creating this control, I have created one more custom control (named
as composite calendar) using this custom calendar.
My composite calendar has same properties as custom calendar has, so I have
used ‘ControlState’ even for CompositeCalendar control.
Now the error is

When page gets loaded for the first time, there was no problem and page was
displayed as desired.

But when I try to postback the page, it is throwing an error:


The flow is:

1. When the page loads for the first time, the page gets executed

2. The sequence of execution of this process is

a. Store properties in controlstate for CompositeCalendar

b. Store properties in controlstate for CustomCalendar.

3. When the page is posted back

a. Load controlstate values into properties of CompositeCalendar

b. Load controlstate values into properties of CustomCalendar

The process was executed properly, but after execution of ‘LoadControlState’
method, system has thrown the above error.

When I use, custom calendar (base control) alone, there was no problem, but
when I use CompositeCalendar (which internally uses CustomCalendar and other
controls), I got the above problem.

I have no clue, why it is happening and some of the sites stated that it is
because of a bug in Beta 2.

Please suggest me the possible solution.
Dec 7 '05 #1
0 1460

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by p | last post: by
6 posts views Thread by Steve Amey | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

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.