Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / June 2004

Tip: Looking for answers? Try searching our database.

Controlling dynamic contols

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Assaf - 22 Jun 2004 22:22 GMT
I'm looking for the 'right way' to save the state of dynamically created
custom controls. Here's the scenario:

Multiple instances of myCustomControl are added to a page programmatically
at run time. Because they are dynamic, I have to recreate all
myCustomControl's on every postback. For now, I am saving all properties of
myCustomControl's to the ViewState in a serializable 'descriptor' class and
cycle through at page_load. That works fine but it seems like duplicate
effort because every property of every instance has to be written to the
control AND the serializable class. Also, the control is about to grow
complex soon and synchronizing it with a descriptor class will become
cumbersome.

Interested in what others have done in this situation. Has anyone attempted
implementing ISerializable on a custom control and stuffing it into a
ViewState?

Thanks for any advice.

- Assaf
Victor Garcia Aprea [MVP] - 23 Jun 2004 00:55 GMT
Hi Assaf,

This[1] is one way of handing what you're describing,

Also take a look at my posts[2] about viewstate, where I gave low-level
details about the viewstate serializer.

[1] http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
[2] http://weblogs.asp.net/vga

Signature

Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

> I'm looking for the 'right way' to save the state of dynamically created
> custom controls. Here's the scenario:
[quoted text clipped - 16 lines]
>
> - Assaf
Assaf - 24 Jun 2004 03:37 GMT
Victor,

I looked through the DynamicControlsPlaceholder sample and the help file.
Having a hard time following the logic. Do you have a write-up or can you
outline the solution?

Thanks.

Assaf

> Hi Assaf,
>
[quoted text clipped - 4 lines]
>
> [1]
http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
> [2] http://weblogs.asp.net/vga
>
[quoted text clipped - 21 lines]
> >
> > - Assaf
Mircea Pleteriu - 25 Jun 2004 10:08 GMT
Hi,

I have a web composite control which consists in a DataGrid control for
beginning.

The data grid is created dynamically by the CreateChildContols method.

When my custom control is hosted by the aspx page I can see that the inner
grid is not persisted.

How can I use your example about persisting control to implement the
behavior I need for my control?

Best regards,

             Mircea

> Hi Assaf,
>
[quoted text clipped - 4 lines]
>
> [1]
http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx
> [2] http://weblogs.asp.net/vga
>
[quoted text clipped - 21 lines]
> >
> > - Assaf

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.