all groups > asp.net building controls > december 2005 >
You're in the

asp.net building controls

group:

LoadControl and Validation Summary


LoadControl and Validation Summary Doug Heeren
12/29/2005 2:52:02 PM
asp.net building controls: 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,

--
Doug Heeren
Project Manager
Annett Holdings, Inc.
Re: LoadControl and Validation Summary Mike MacMillan
12/29/2005 4:01:34 PM
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



[quoted text, click to view]
Re: LoadControl and Validation Summary Doug Heeren
12/29/2005 7:36:02 PM
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
--
Doug Heeren
Project Manager
Annett Holdings, Inc.
(515) 256-2918


[quoted text, click to view]
AddThis Social Bookmark Button