CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2006
    Posts
    19

    Masterpages / Forms question

    hello,

    I'm using masterpages in my asp.net web application, my problem is that the login is placed in the masterpage.
    That works actually very well, but on some content pages I'm using validate controls and a submit button aswell.

    So, If you open such a page and you are not logged in and you click on
    the login button in the masterpage, the validate control elements don't allow the submit.

    It's only one form, even with a masterpage, but how can I work around this problem ?

  2. #2
    Join Date
    Jul 2006
    Posts
    2

    Re: Masterpages / Forms question

    Quote Originally Posted by AndyTheAce
    hello,

    I'm using masterpages in my asp.net web application, my problem is that the login is placed in the masterpage.
    That works actually very well, but on some content pages I'm using validate controls and a submit button aswell.

    So, If you open such a page and you are not logged in and you click on
    the login button in the masterpage, the validate control elements don't allow the submit.

    It's only one form, even with a masterpage, but how can I work around this problem ?
    Hi,

    You can turn-off validation. It's property CausesValidation. Assign all the other elements to a Validation group and turn that validation group off when clicking on the login button. You will need to do that with JavaScript.

    If that doesn't work, have you tried to forcefully do a post back using javascript:

    Client side:
    javascript:__doPostBack('__Page', 'ACTION_NAME');

    Server side:
    You need to register the post back in PageLoad...
    Page.ClientScript.GetPostBackEventReference(this, "ACTION_NAME");

    Reto
    http://www.xcellery.com

  3. #3
    Join Date
    Jul 2006
    Posts
    19

    Re: Masterpages / Forms question

    Hello & thanks for answer,

    yes I tried it with a manual __doPostBack by using btnname.Attributes.Add().
    Didn't work, the postback was also blocked by the javascript code from the validation.

    You said I could turn off the validation manually, I have not a clue how to do this. I guess I must implement a javascript aswell, but what have I to do in the script?

  4. #4
    Join Date
    Jul 2006
    Posts
    2

    Re: Masterpages / Forms question

    Quote Originally Posted by AndyTheAce
    Hello & thanks for answer,

    yes I tried it with a manual __doPostBack by using btnname.Attributes.Add().
    Didn't work, the postback was also blocked by the javascript code from the validation.

    You said I could turn off the validation manually, I have not a clue how to do this. I guess I must implement a javascript aswell, but what have I to do in the script?
    Hi,

    Read this article. http://msdn.microsoft.com/msdnmag/issues/02/04/Valid/
    There it talks about disabling validations.

    Reto
    www.xcellery.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured