Multiview and Validation

Discussion in 'ASP .Net Web Controls' started by Chuck P, Nov 15, 2006.

  1. Chuck P

    Chuck P Guest

    I am using a Multiview control and some validators.
    The multiview is being used in a homegrown tab control
    Click on a tab it display one of the views.

    I have a submit button that I would like to validate all of the
    controls in all of the views within the multivew.

    I am guessing their is no way this going to happen on the client,
    since the controls on the non-displayed views are not available to the
    DOM/javascript?

    However, on page postback if I do page.validate, page.isValid. I
    don't believe the controls in the other views are being tested. How
    can I validate all the controls within the multiview?
    Chuck P, Nov 15, 2006
    #1
    1. Advertising

  2. Hi Chuck,

    It's a design decision that controls/validators in a hidden View will not
    be validated; also you're right about the client-side validation: the
    controls inside hidden View aren't rendered to client at all, thus not
    possible to validate them at client-side.

    As a workaround, I'm afraid you will have to manually make each View active
    then do the validation again:

    private void ValidateMultiView(MultiView mv)
    {
    int savedIndex = mv.ActiveViewIndex;
    for (int i = 0; i < mv.Views.Count; i++)
    {
    mv.ActiveViewIndex = i;
    Page.Validate();
    }
    mv.ActiveViewIndex = savedIndex;
    }


    Note: if you have code in the MultiView's event ActiveViewChanged, please
    be aware that above code will trigger the event too; you might want to use
    a member variable to bypass the logic there if it's caused by this function.

    Sincerely,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications. If you are using Outlook Express, please make sure you clear the
    check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
    promptly.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Walter Wang [MSFT], Nov 16, 2006
    #2
    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. Mavenos

    Ajax and .net multiview control

    Mavenos, Feb 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    5,899
  2. Liming

    Multiview and browser back button

    Liming, Apr 20, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    2,145
    Joerg Jooss
    Apr 20, 2006
  3. M. Ali Qureshi

    Multiview and field validation

    M. Ali Qureshi, Nov 18, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    789
    M. Ali Qureshi
    Nov 19, 2007
  4. iHavAQuestion
    Replies:
    0
    Views:
    561
    iHavAQuestion
    Apr 28, 2008
  5. Andy B
    Replies:
    0
    Views:
    357
    Andy B
    Dec 29, 2008
Loading...

Share This Page