Ask a Question related to ASP.NET Building Controls, Design and Development.
-
Pavan #1
Error while using 'ControlState' property in my custom control
My name is Pavan and I am a software engineer working on ASP .Net web
development.
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:
'COLLECTION WAS MODIFIED AFTER THE ENUMERATOR WAS INSTANTIATED'
The flow is:
1. When the page loads for the first time, the page gets executed
normally.
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.
--
Cheers,
Pavan
Pavan Guest
-
Custom control with complex property type (System.Web.UI.Control[])
I've built a control with a property of type System.Web.UI.Control. I have a custom editor which allows me to add items to this collection at... -
Problem with Custom Web Control Property
Hello all, I'm developing a custom web control that mount a webpage, but now i don't can to modify the properties of my custom web control. by... -
Missing ID property for a custom control
Hello, When i'm using a custom control in my project, i can see that the custom control is missing it's ID in the HTML file. I can see the object... -
Keep custom property-value in custom rendered control
Hi there, here's the thing I have a custom control (rendered) with a label, textbox and some validators. I use that for entering a birthdate, to... -
Custom Control nad Collection property
I have a collection-property on my control. I Add the items through a collection editor, and items tags appears. <bugge:Control>...



Reply With Quote

