• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

ASPNET: Server control: viewstate of child controls and LoadPostData

Hi experts,
I'm developing a CompositeControl which contains 3 child controls.
My problem is: when the page is posted back, the LoadViewState of my control is called before that of child controls, i.e. in the LoadViewState method, child controls are not ready. I want to find a place where the child controls' states are ready for use so that I can use them to restore some data field of the parent control. I try the LoadPostData method, but it is not called when the page is posted back like the document says.
So my questions are:
1. In what event the states of child controls are ready for use?
2. Why is the LoadPostData method not called?
Thank you for reading.
thuannguy.
0
thuannguy
Asked:
thuannguy
  • 2
1 Solution
 
SteveH_UKCommented:
1. You should handle the Control's Load event instead.  See http://msdn2.microsoft.com/en-us/library/system.web.ui.control.load(VS.80).aspx

2.  This method is used internally.  It is not supported.
0
 
thuannguyAuthor Commented:
1. I found another workaround for my problem.
2. It's so weird because the method is virtual and can be overriden.
Anyway, thanks for your help.
0
 
SteveH_UKCommented:
You're welcome.  Glad you've got it sorted.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now