LoadControl and Validation Summary

D

Doug Heeren

I am working on a project that dynamically loads controls from within
Page_init so that the viewstate is preserved. On post back the control saves
it's changs in the Page_load event. If the user navigates to another section
the control is removed in the page load event and a second control is loaded
by the button fire event. This all works very well, but when I add a
validation summary to the parent page I run into an issue.

The first control to load works fine, when the user navigates to another
section the second control is loaded and appears to work, but when the user
tries to navigate to a third section the validation summary lists all the
controls in the first control to load as being in error since there is no
data in them.

What is going on here and how do I "reset" the validation summary? I'd post
the code, but there are about 500 lines of it in the parent page. I figure
the answer is farily simple and lies in a lack of understanding on my part
about loading/unloading controls dymacially, but I can't seem to find
anything on a search engine that is of much use in explaining this to me.

Any help will be highly appreciated,
 
M

Mike MacMillan

Doug,
if i understand correctly, you're having issues with the wrong set of
controls being validated for certain steps. are you persisting
(perhaps hardcoding...?) which controls are bound to each step
somewhere? this sounds like you have a multi step wizard type app
wrapped into a single .aspx page. perhaps you can abstract each
section/step to its own user control, that way the parent page can call
a .Validate method so each step only validates its own controls.
seperating the logic for each step will allow you quite a bit more
flexibility. let me know if im not understanding your issue correctly.
if you can provide some code snippets that somewhat explain your
architecture, it will help diagnosing your issue.

hope this helps,
Mike MacMillan
 
D

Doug Heeren

Mike,
You are correct about the nature of the application. Only one control is
loaded at a time, the problem I am having, I belive, is because I've set
showsummary = False and showmessagebox = true on the validation summary. Is
the javascript for the validation summary cached? I've not hardcoded anything
each controls validate method is being called, but it is on the client side
where I am having issues. I wasn't very clear about in my post.

I've tried to remove all the validators from the summary after I am done
saving the changes that the user made before moving on to load the next
control, but on the client side it is still trying to do something with a
control that has not even loaded. Is there something I need to do (syncroot)
with the page or validation summary?

Thanks in advance,

Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top