LoadControl and Validation Summary

Discussion in 'ASP .Net Building Controls' started by Doug Heeren, Dec 29, 2005.

  1. Doug Heeren

    Doug Heeren Guest

    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.
    (515) 256-2918
    Doug Heeren, Dec 29, 2005
    #1
    1. Advertising

  2. 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



    Doug Heeren wrote:
    > 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.
    > (515) 256-2918
    Mike MacMillan, Dec 30, 2005
    #2
    1. Advertising

  3. Doug Heeren

    Doug Heeren Guest

    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


    "Mike MacMillan" wrote:

    > 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
    >
    >
    >
    > Doug Heeren wrote:
    > > 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.
    > > (515) 256-2918

    >
    >
    Doug Heeren, Dec 30, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Libs
    Replies:
    0
    Views:
    1,491
  2. Lucas Tam
    Replies:
    2
    Views:
    1,107
    Lucas Tam
    Feb 26, 2004
  3. =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=

    Using Summary Validation control with server Custom validation

    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=, Oct 15, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    880
    =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?=
    Oct 15, 2004
  4. Replies:
    1
    Views:
    3,775
    bruce barker
    Dec 12, 2008
  5. Deane
    Replies:
    0
    Views:
    864
    Deane
    Sep 3, 2007
Loading...

Share This Page