cant figure out what is causes server-side validation

Discussion in 'ASP .Net' started by AFN, Dec 15, 2004.

  1. AFN

    AFN Guest

    I was just dropped into someone else's code (isn't that always so fun?).

    I can't figure out why a custom validation control's server event function
    is executing. There is nothing (that I see) in page_load, or elsewhere,
    that says page.validate, no control says "causesvalidation=true", and the
    AutoEventWireup is set to false. So I would think that the control's
    server event function would NOT execute, but it does execute right after
    page_load. I want to call page.validate (followed by if page.isvalid ...)
    elsewhere, but that means that the event function code will run twice, which
    I don't want.

    Where else do I look to see why the custom validator's event function is
    executing on the server after page_load?
     
    AFN, Dec 15, 2004
    #1
    1. Advertising

  2. AFN

    bruce barker Guest

    Page.IsValid is what triggers server side validation

    -- bruce (sqlwork.com)

    "AFN" <> wrote in message
    news:iNLvd.14669$...
    | I was just dropped into someone else's code (isn't that always so fun?).
    |
    | I can't figure out why a custom validation control's server event function
    | is executing. There is nothing (that I see) in page_load, or elsewhere,
    | that says page.validate, no control says "causesvalidation=true", and the
    | AutoEventWireup is set to false. So I would think that the control's
    | server event function would NOT execute, but it does execute right after
    | page_load. I want to call page.validate (followed by if page.isvalid
    ....)
    | elsewhere, but that means that the event function code will run twice,
    which
    | I don't want.
    |
    | Where else do I look to see why the custom validator's event function is
    | executing on the server after page_load?
    |
    |
     
    bruce barker, Dec 15, 2004
    #2
    1. Advertising

  3. AFN

    AFN Guest

    It is going to the validation function BEFORE page.validate & page.isvalid.
    That's what puzzles me. I know it will go there upon page.validate, but
    can't figure out what else BEFORE that is triggering it.


    "bruce barker" <> wrote in message
    news:...
    > Page.IsValid is what triggers server side validation
    >
    > -- bruce (sqlwork.com)
    >
    > "AFN" <> wrote in message
    > news:iNLvd.14669$...
    > | I was just dropped into someone else's code (isn't that always so fun?).
    > |
    > | I can't figure out why a custom validation control's server event

    function
    > | is executing. There is nothing (that I see) in page_load, or

    elsewhere,
    > | that says page.validate, no control says "causesvalidation=true", and

    the
    > | AutoEventWireup is set to false. So I would think that the control's
    > | server event function would NOT execute, but it does execute right after
    > | page_load. I want to call page.validate (followed by if page.isvalid
    > ...)
    > | elsewhere, but that means that the event function code will run twice,
    > which
    > | I don't want.
    > |
    > | Where else do I look to see why the custom validator's event function is
    > | executing on the server after page_load?
    > |
    > |
    >
    >
     
    AFN, Dec 15, 2004
    #3
  4. AFN

    Peter Blum Guest

    The Button control calls Page.Validate() internally just before it calls any
    Click event handler. CausesValidation=true is the true. So if you don't see
    it listed in the ASP.NET definition of the button, Page.Validate() is being
    fired.

    Only when Page.Validate() or the individual validator's Validate() method is
    called will the validator run its custom evaluation function.

    In your case, its clear that the button is calling Page.Validate for you and
    that is running your event method.

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "AFN" <> wrote in message
    news:V9Mvd.14672$...
    > It is going to the validation function BEFORE page.validate &
    > page.isvalid.
    > That's what puzzles me. I know it will go there upon page.validate, but
    > can't figure out what else BEFORE that is triggering it.
    >
    >
    > "bruce barker" <> wrote in message
    > news:...
    >> Page.IsValid is what triggers server side validation
    >>
    >> -- bruce (sqlwork.com)
    >>
    >> "AFN" <> wrote in
    >> message
    >> news:iNLvd.14669$...
    >> | I was just dropped into someone else's code (isn't that always so
    >> fun?).
    >> |
    >> | I can't figure out why a custom validation control's server event

    > function
    >> | is executing. There is nothing (that I see) in page_load, or

    > elsewhere,
    >> | that says page.validate, no control says "causesvalidation=true", and

    > the
    >> | AutoEventWireup is set to false. So I would think that the control's
    >> | server event function would NOT execute, but it does execute right
    >> after
    >> | page_load. I want to call page.validate (followed by if page.isvalid
    >> ...)
    >> | elsewhere, but that means that the event function code will run twice,
    >> which
    >> | I don't want.
    >> |
    >> | Where else do I look to see why the custom validator's event function
    >> is
    >> | executing on the server after page_load?
    >> |
    >> |
    >>
    >>

    >
    >
     
    Peter Blum, Dec 15, 2004
    #4
  5. AFN

    AFN Guest

    I appreciate the reply, but I'm still a bit confused.

    I don't have any submit buttons. Instead I'm using an "HtmlInputImage"
    control (an image button). In its properties, it does not show any
    "CausesValidation" property, either.



    "Peter Blum" <> wrote in message
    news:...
    > The Button control calls Page.Validate() internally just before it calls

    any
    > Click event handler. CausesValidation=true is the true. So if you don't

    see
    > it listed in the ASP.NET definition of the button, Page.Validate() is

    being
    > fired.
    >
    > Only when Page.Validate() or the individual validator's Validate() method

    is
    > called will the validator run its custom evaluation function.
    >
    > In your case, its clear that the button is calling Page.Validate for you

    and
    > that is running your event method.
    >
    > --- Peter Blum
    > www.PeterBlum.com
    > Email:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "AFN" <> wrote in message
    > news:V9Mvd.14672$...
    > > It is going to the validation function BEFORE page.validate &
    > > page.isvalid.
    > > That's what puzzles me. I know it will go there upon page.validate,

    but
    > > can't figure out what else BEFORE that is triggering it.
    > >
    > >
    > > "bruce barker" <> wrote in message
    > > news:...
    > >> Page.IsValid is what triggers server side validation
    > >>
    > >> -- bruce (sqlwork.com)
    > >>
    > >> "AFN" <> wrote in
    > >> message
    > >> news:iNLvd.14669$...
    > >> | I was just dropped into someone else's code (isn't that always so
    > >> fun?).
    > >> |
    > >> | I can't figure out why a custom validation control's server event

    > > function
    > >> | is executing. There is nothing (that I see) in page_load, or

    > > elsewhere,
    > >> | that says page.validate, no control says "causesvalidation=true", and

    > > the
    > >> | AutoEventWireup is set to false. So I would think that the

    control's
    > >> | server event function would NOT execute, but it does execute right
    > >> after
    > >> | page_load. I want to call page.validate (followed by if

    page.isvalid
    > >> ...)
    > >> | elsewhere, but that means that the event function code will run

    twice,
    > >> which
    > >> | I don't want.
    > >> |
    > >> | Where else do I look to see why the custom validator's event function
    > >> is
    > >> | executing on the server after page_load?
    > >> |
    > >> |
    > >>
    > >>

    > >
    > >

    >
    >
     
    AFN, Dec 15, 2004
    #5
  6. AFN

    AFN Guest

    I see that intellisense does bring up a CausesValidation property on my
    HtmlInputImage "button". I set it to false in page_load, but the
    server-side function is still running. In case it makes any difference, I
    have text boxes, pulldowns, and text inside a user control on this page.
    What else could be causing validation??? I'm pulling my hair out over this.



    "AFN" <> wrote in message
    news:H43wd.15549$...
    > I appreciate the reply, but I'm still a bit confused.
    >
    > I don't have any submit buttons. Instead I'm using an "HtmlInputImage"
    > control (an image button). In its properties, it does not show any
    > "CausesValidation" property, either.
    >
    >
    >
    > "Peter Blum" <> wrote in message
    > news:...
    > > The Button control calls Page.Validate() internally just before it calls

    > any
    > > Click event handler. CausesValidation=true is the true. So if you don't

    > see
    > > it listed in the ASP.NET definition of the button, Page.Validate() is

    > being
    > > fired.
    > >
    > > Only when Page.Validate() or the individual validator's Validate()

    method
    > is
    > > called will the validator run its custom evaluation function.
    > >
    > > In your case, its clear that the button is calling Page.Validate for you

    > and
    > > that is running your event method.
    > >
    > > --- Peter Blum
    > > www.PeterBlum.com
    > > Email:
    > > Creator of "Professional Validation And More" at
    > > http://www.peterblum.com/vam/home.aspx
    > >
    > > "AFN" <> wrote in

    message
    > > news:V9Mvd.14672$...
    > > > It is going to the validation function BEFORE page.validate &
    > > > page.isvalid.
    > > > That's what puzzles me. I know it will go there upon page.validate,

    > but
    > > > can't figure out what else BEFORE that is triggering it.
    > > >
    > > >
    > > > "bruce barker" <> wrote in message
    > > > news:...
    > > >> Page.IsValid is what triggers server side validation
    > > >>
    > > >> -- bruce (sqlwork.com)
    > > >>
    > > >> "AFN" <> wrote in
    > > >> message
    > > >> news:iNLvd.14669$...
    > > >> | I was just dropped into someone else's code (isn't that always so
    > > >> fun?).
    > > >> |
    > > >> | I can't figure out why a custom validation control's server event
    > > > function
    > > >> | is executing. There is nothing (that I see) in page_load, or
    > > > elsewhere,
    > > >> | that says page.validate, no control says "causesvalidation=true",

    and
    > > > the
    > > >> | AutoEventWireup is set to false. So I would think that the

    > control's
    > > >> | server event function would NOT execute, but it does execute right
    > > >> after
    > > >> | page_load. I want to call page.validate (followed by if

    > page.isvalid
    > > >> ...)
    > > >> | elsewhere, but that means that the event function code will run

    > twice,
    > > >> which
    > > >> | I don't want.
    > > >> |
    > > >> | Where else do I look to see why the custom validator's event

    function
    > > >> is
    > > >> | executing on the server after page_load?
    > > >> |
    > > >> |
    > > >>
    > > >>
    > > >
    > > >

    > >
    > >

    >
    >
     
    AFN, Dec 15, 2004
    #6
  7. AFN

    Peter Blum Guest

    I recently posted this thread that breaks the process down in detail:
    http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=773590

    The CausesValidation=false prevents your HtmlInputImage button from
    automatically calling Page.Validate(). If your custom validator's evaluation
    method is getting called, it MUST be due to a call to Page.Validate() or
    your own validator's Validate() method. There is no magic here. The code
    executes based on specific conditions.

    So if you cannot find Page.Validate() or Validate() on your individual
    validator on this page, then you must assume its getting called by the image
    button that ASP.NET thinks submitted the page. If you have Visual
    Studio.net, you can put a breakpoint in your server side method. When its
    hit, look through the call stack to see what invoked it.
    You can also check that CausesValidation is false at this time. I bet its
    not.

    A common mistake in Page_Load is to put code inside IF Not IsPostBack
    statements when it belongs available at all times. Did you do this with
    CausesValidation?

    --- Peter Blum
    www.PeterBlum.com
    Email:
    Creator of "Professional Validation And More" at
    http://www.peterblum.com/vam/home.aspx

    "AFN" <> wrote in message
    news:Vp3wd.15552$...
    >I see that intellisense does bring up a CausesValidation property on my
    > HtmlInputImage "button". I set it to false in page_load, but the
    > server-side function is still running. In case it makes any difference,
    > I
    > have text boxes, pulldowns, and text inside a user control on this page.
    > What else could be causing validation??? I'm pulling my hair out over
    > this.
    >
    >
    >
    > "AFN" <> wrote in message
    > news:H43wd.15549$...
    >> I appreciate the reply, but I'm still a bit confused.
    >>
    >> I don't have any submit buttons. Instead I'm using an "HtmlInputImage"
    >> control (an image button). In its properties, it does not show any
    >> "CausesValidation" property, either.
    >>
    >>
    >>
    >> "Peter Blum" <> wrote in message
    >> news:...
    >> > The Button control calls Page.Validate() internally just before it
    >> > calls

    >> any
    >> > Click event handler. CausesValidation=true is the true. So if you don't

    >> see
    >> > it listed in the ASP.NET definition of the button, Page.Validate() is

    >> being
    >> > fired.
    >> >
    >> > Only when Page.Validate() or the individual validator's Validate()

    > method
    >> is
    >> > called will the validator run its custom evaluation function.
    >> >
    >> > In your case, its clear that the button is calling Page.Validate for
    >> > you

    >> and
    >> > that is running your event method.
    >> >
    >> > --- Peter Blum
    >> > www.PeterBlum.com
    >> > Email:
    >> > Creator of "Professional Validation And More" at
    >> > http://www.peterblum.com/vam/home.aspx
    >> >
    >> > "AFN" <> wrote in

    > message
    >> > news:V9Mvd.14672$...
    >> > > It is going to the validation function BEFORE page.validate &
    >> > > page.isvalid.
    >> > > That's what puzzles me. I know it will go there upon page.validate,

    >> but
    >> > > can't figure out what else BEFORE that is triggering it.
    >> > >
    >> > >
    >> > > "bruce barker" <> wrote in message
    >> > > news:...
    >> > >> Page.IsValid is what triggers server side validation
    >> > >>
    >> > >> -- bruce (sqlwork.com)
    >> > >>
    >> > >> "AFN" <> wrote in
    >> > >> message
    >> > >> news:iNLvd.14669$...
    >> > >> | I was just dropped into someone else's code (isn't that always so
    >> > >> fun?).
    >> > >> |
    >> > >> | I can't figure out why a custom validation control's server event
    >> > > function
    >> > >> | is executing. There is nothing (that I see) in page_load, or
    >> > > elsewhere,
    >> > >> | that says page.validate, no control says "causesvalidation=true",

    > and
    >> > > the
    >> > >> | AutoEventWireup is set to false. So I would think that the

    >> control's
    >> > >> | server event function would NOT execute, but it does execute right
    >> > >> after
    >> > >> | page_load. I want to call page.validate (followed by if

    >> page.isvalid
    >> > >> ...)
    >> > >> | elsewhere, but that means that the event function code will run

    >> twice,
    >> > >> which
    >> > >> | I don't want.
    >> > >> |
    >> > >> | Where else do I look to see why the custom validator's event

    > function
    >> > >> is
    >> > >> | executing on the server after page_load?
    >> > >> |
    >> > >> |
    >> > >>
    >> > >>
    >> > >
    >> > >
    >> >
    >> >

    >>
    >>

    >
    >
     
    Peter Blum, Dec 16, 2004
    #7
  8. AFN

    AFN Guest

    Thanks for your reply. OK, I've done more evaluation and testing, but
    still no luck...

    The page has 2 image buttons, one at the top and one at the bottom. Both
    are definitely set to "causesvalidation=false" everywhere, and I've
    confirmed such by testing the variables in the command window at every stage
    of running the page. And no "causesvalidation=false" lines of code are
    within an "if/then" condition.

    Remember, in case it makes any difference, that the page has a user control
    within it, containing text boxes and 4 custom validators, but that control
    has no image or standard buttons, and nothing that has a causesvalidation
    property (to the best of my knowledge and i've looked hard now).

    I run the page.
    I click the image button which is on the page, under the user control.
    The page_load fires for the main page
    The page_load fires for the user control
    The next thing that fires is the sub for the image's ServerClick
    That ServerClick sub calls page.validate (I understand this will trigger
    validation ONCE)
    The user control's CustomValidator1 sub runs, as I would expect
    The user control's CustomValidator2 sub runs, as I would expect
    The user control's CustomValidator3 sub runs, as I would expect
    The user control's CustomValidator4 sub runs, as I would expect
    *** this is where I'm absolutely puzzled, here down ***
    The user control's CustomValidator1 sub runs AGAIN, as I would NOT expect
    The user control's CustomValidator2 sub runs AGAIN, as I would NOT expect
    The user control's CustomValidator3 sub runs AGAIN, as I would NOT expect
    The user control's CustomValidator4 sub runs AGAIN, as I would NOT expect
    control returns back to the next line after page.validate, which is "If
    page.IsValid ..."


    The call stack doesn't seem to show anything helpful. It just shows that
    the source on each entry into a custom validator's sub is itself
    (System.Web.UI.WebControls.CustomValidator.

    The validators are also not making any extra calls to functions that could
    potentially do another page.validate. They simply check simple things like
    the length of a textbox field.

    Any ideas???





    "Peter Blum" <> wrote in message
    news:uF62$...
    > I recently posted this thread that breaks the process down in detail:
    > http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=773590
    >
    > The CausesValidation=false prevents your HtmlInputImage button from
    > automatically calling Page.Validate(). If your custom validator's

    evaluation
    > method is getting called, it MUST be due to a call to Page.Validate() or
    > your own validator's Validate() method. There is no magic here. The code
    > executes based on specific conditions.
    >
    > So if you cannot find Page.Validate() or Validate() on your individual
    > validator on this page, then you must assume its getting called by the

    image
    > button that ASP.NET thinks submitted the page. If you have Visual
    > Studio.net, you can put a breakpoint in your server side method. When its
    > hit, look through the call stack to see what invoked it.
    > You can also check that CausesValidation is false at this time. I bet its
    > not.
    >
    > A common mistake in Page_Load is to put code inside IF Not IsPostBack
    > statements when it belongs available at all times. Did you do this with
    > CausesValidation?
    >
    > --- Peter Blum
    > www.PeterBlum.com
    > Email:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "AFN" <> wrote in message
    > news:Vp3wd.15552$...
    > >I see that intellisense does bring up a CausesValidation property on my
    > > HtmlInputImage "button". I set it to false in page_load, but the
    > > server-side function is still running. In case it makes any

    difference,
    > > I
    > > have text boxes, pulldowns, and text inside a user control on this page.
    > > What else could be causing validation??? I'm pulling my hair out over
    > > this.
    > >
    > >
    > >
    > > "AFN" <> wrote in

    message
    > > news:H43wd.15549$...
    > >> I appreciate the reply, but I'm still a bit confused.
    > >>
    > >> I don't have any submit buttons. Instead I'm using an "HtmlInputImage"
    > >> control (an image button). In its properties, it does not show any
    > >> "CausesValidation" property, either.
    > >>
    > >>
    > >>
    > >> "Peter Blum" <> wrote in message
    > >> news:...
    > >> > The Button control calls Page.Validate() internally just before it
    > >> > calls
    > >> any
    > >> > Click event handler. CausesValidation=true is the true. So if you

    don't
    > >> see
    > >> > it listed in the ASP.NET definition of the button, Page.Validate() is
    > >> being
    > >> > fired.
    > >> >
    > >> > Only when Page.Validate() or the individual validator's Validate()

    > > method
    > >> is
    > >> > called will the validator run its custom evaluation function.
    > >> >
    > >> > In your case, its clear that the button is calling Page.Validate for
    > >> > you
    > >> and
    > >> > that is running your event method.
    > >> >
    > >> > --- Peter Blum
    > >> > www.PeterBlum.com
    > >> > Email:
    > >> > Creator of "Professional Validation And More" at
    > >> > http://www.peterblum.com/vam/home.aspx
    > >> >
    > >> > "AFN" <> wrote in

    > > message
    > >> > news:V9Mvd.14672$...
    > >> > > It is going to the validation function BEFORE page.validate &
    > >> > > page.isvalid.
    > >> > > That's what puzzles me. I know it will go there upon

    page.validate,
    > >> but
    > >> > > can't figure out what else BEFORE that is triggering it.
    > >> > >
    > >> > >
    > >> > > "bruce barker" <> wrote in message
    > >> > > news:...
    > >> > >> Page.IsValid is what triggers server side validation
    > >> > >>
    > >> > >> -- bruce (sqlwork.com)
    > >> > >>
    > >> > >> "AFN" <> wrote in
    > >> > >> message
    > >> > >> news:iNLvd.14669$...
    > >> > >> | I was just dropped into someone else's code (isn't that always

    so
    > >> > >> fun?).
    > >> > >> |
    > >> > >> | I can't figure out why a custom validation control's server

    event
    > >> > > function
    > >> > >> | is executing. There is nothing (that I see) in page_load, or
    > >> > > elsewhere,
    > >> > >> | that says page.validate, no control says

    "causesvalidation=true",
    > > and
    > >> > > the
    > >> > >> | AutoEventWireup is set to false. So I would think that the
    > >> control's
    > >> > >> | server event function would NOT execute, but it does execute

    right
    > >> > >> after
    > >> > >> | page_load. I want to call page.validate (followed by if
    > >> page.isvalid
    > >> > >> ...)
    > >> > >> | elsewhere, but that means that the event function code will run
    > >> twice,
    > >> > >> which
    > >> > >> | I don't want.
    > >> > >> |
    > >> > >> | Where else do I look to see why the custom validator's event

    > > function
    > >> > >> is
    > >> > >> | executing on the server after page_load?
    > >> > >> |
    > >> > >> |
    > >> > >>
    > >> > >>
    > >> > >
    > >> > >
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >
     
    AFN, Dec 17, 2004
    #8
  9. Server-side validation is by default. Look into the custom validator
    control that provides for a server_validate function, for the rest of
    the controls, it is managed andin-built by ASP.Net.

    ASP.Net is a disconnected environment and is not like the Windows local
    environment where you can cause the validate function to occur on a
    form.

    with regards,


    J.V.Ravichandran
    - http://www.geocities.com/
    jvravichandran
    - http://www.411asp.net/func/search?
    qry=Ravichandran+J.V.&cob=aspnetpro
    - http://www.southasianoutlook.com
    - http://www.MSDNAA.Net
    - http://www.csharphelp.com
    - http://www.poetry.com/Publications/
    display.asp?ID=P3966388&BN=999&PN=2
    - Or, just search on "J.V.Ravichandran"
    at http://www.Google.com

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Ravichandran J.V., Dec 18, 2004
    #9
  10. AFN

    AFN Guest

    I found the solution/answer.

    The pages were using a custom template base class.

    The 1.1 framework had a bug that dropped validators when copying controls.
    So you had to save a copy of validators before adding the page into the
    template, and then add them back manually.

    The recent 1.1 service pack fixed that bug.

    My code had the bug workaround. My machine had the latest 1.1 fix. So the
    code was effectively adding a copy of each validator, internally where I
    couldn't see it, and that is why each validator event was firing twice even
    though you would not see two of the same validator when examining the code!




    "AFN" <> wrote in message
    news:bHGwd.17940$...
    > Thanks for your reply. OK, I've done more evaluation and testing, but
    > still no luck...
    >
    > The page has 2 image buttons, one at the top and one at the bottom. Both
    > are definitely set to "causesvalidation=false" everywhere, and I've
    > confirmed such by testing the variables in the command window at every

    stage
    > of running the page. And no "causesvalidation=false" lines of code are
    > within an "if/then" condition.
    >
    > Remember, in case it makes any difference, that the page has a user

    control
    > within it, containing text boxes and 4 custom validators, but that control
    > has no image or standard buttons, and nothing that has a causesvalidation
    > property (to the best of my knowledge and i've looked hard now).
    >
    > I run the page.
    > I click the image button which is on the page, under the user control.
    > The page_load fires for the main page
    > The page_load fires for the user control
    > The next thing that fires is the sub for the image's ServerClick
    > That ServerClick sub calls page.validate (I understand this will trigger
    > validation ONCE)
    > The user control's CustomValidator1 sub runs, as I would expect
    > The user control's CustomValidator2 sub runs, as I would expect
    > The user control's CustomValidator3 sub runs, as I would expect
    > The user control's CustomValidator4 sub runs, as I would expect
    > *** this is where I'm absolutely puzzled, here down ***
    > The user control's CustomValidator1 sub runs AGAIN, as I would NOT

    expect
    > The user control's CustomValidator2 sub runs AGAIN, as I would NOT

    expect
    > The user control's CustomValidator3 sub runs AGAIN, as I would NOT

    expect
    > The user control's CustomValidator4 sub runs AGAIN, as I would NOT

    expect
    > control returns back to the next line after page.validate, which is "If
    > page.IsValid ..."
    >
    >
    > The call stack doesn't seem to show anything helpful. It just shows that
    > the source on each entry into a custom validator's sub is itself
    > (System.Web.UI.WebControls.CustomValidator.
    >
    > The validators are also not making any extra calls to functions that could
    > potentially do another page.validate. They simply check simple things

    like
    > the length of a textbox field.
    >
    > Any ideas???
    >
    >
    >
    >
    >
    > "Peter Blum" <> wrote in message
    > news:uF62$...
    > > I recently posted this thread that breaks the process down in detail:
    > > http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=773590
    > >
    > > The CausesValidation=false prevents your HtmlInputImage button from
    > > automatically calling Page.Validate(). If your custom validator's

    > evaluation
    > > method is getting called, it MUST be due to a call to Page.Validate() or
    > > your own validator's Validate() method. There is no magic here. The code
    > > executes based on specific conditions.
    > >
    > > So if you cannot find Page.Validate() or Validate() on your individual
    > > validator on this page, then you must assume its getting called by the

    > image
    > > button that ASP.NET thinks submitted the page. If you have Visual
    > > Studio.net, you can put a breakpoint in your server side method. When

    its
    > > hit, look through the call stack to see what invoked it.
    > > You can also check that CausesValidation is false at this time. I bet

    its
    > > not.
    > >
    > > A common mistake in Page_Load is to put code inside IF Not IsPostBack
    > > statements when it belongs available at all times. Did you do this with
    > > CausesValidation?
    > >
    > > --- Peter Blum
    > > www.PeterBlum.com
    > > Email:
    > > Creator of "Professional Validation And More" at
    > > http://www.peterblum.com/vam/home.aspx
    > >
    > > "AFN" <> wrote in

    message
    > > news:Vp3wd.15552$...
    > > >I see that intellisense does bring up a CausesValidation property on my
    > > > HtmlInputImage "button". I set it to false in page_load, but the
    > > > server-side function is still running. In case it makes any

    > difference,
    > > > I
    > > > have text boxes, pulldowns, and text inside a user control on this

    page.
    > > > What else could be causing validation??? I'm pulling my hair out over
    > > > this.
    > > >
    > > >
    > > >
    > > > "AFN" <> wrote in

    > message
    > > > news:H43wd.15549$...
    > > >> I appreciate the reply, but I'm still a bit confused.
    > > >>
    > > >> I don't have any submit buttons. Instead I'm using an

    "HtmlInputImage"
    > > >> control (an image button). In its properties, it does not show any
    > > >> "CausesValidation" property, either.
    > > >>
    > > >>
    > > >>
    > > >> "Peter Blum" <> wrote in message
    > > >> news:...
    > > >> > The Button control calls Page.Validate() internally just before it
    > > >> > calls
    > > >> any
    > > >> > Click event handler. CausesValidation=true is the true. So if you

    > don't
    > > >> see
    > > >> > it listed in the ASP.NET definition of the button, Page.Validate()

    is
    > > >> being
    > > >> > fired.
    > > >> >
    > > >> > Only when Page.Validate() or the individual validator's Validate()
    > > > method
    > > >> is
    > > >> > called will the validator run its custom evaluation function.
    > > >> >
    > > >> > In your case, its clear that the button is calling Page.Validate

    for
    > > >> > you
    > > >> and
    > > >> > that is running your event method.
    > > >> >
    > > >> > --- Peter Blum
    > > >> > www.PeterBlum.com
    > > >> > Email:
    > > >> > Creator of "Professional Validation And More" at
    > > >> > http://www.peterblum.com/vam/home.aspx
    > > >> >
    > > >> > "AFN" <> wrote in
    > > > message
    > > >> > news:V9Mvd.14672$...
    > > >> > > It is going to the validation function BEFORE page.validate &
    > > >> > > page.isvalid.
    > > >> > > That's what puzzles me. I know it will go there upon

    > page.validate,
    > > >> but
    > > >> > > can't figure out what else BEFORE that is triggering it.
    > > >> > >
    > > >> > >
    > > >> > > "bruce barker" <> wrote in message
    > > >> > > news:...
    > > >> > >> Page.IsValid is what triggers server side validation
    > > >> > >>
    > > >> > >> -- bruce (sqlwork.com)
    > > >> > >>
    > > >> > >> "AFN" <> wrote

    in
    > > >> > >> message
    > > >> > >> news:iNLvd.14669$...
    > > >> > >> | I was just dropped into someone else's code (isn't that always

    > so
    > > >> > >> fun?).
    > > >> > >> |
    > > >> > >> | I can't figure out why a custom validation control's server

    > event
    > > >> > > function
    > > >> > >> | is executing. There is nothing (that I see) in page_load, or
    > > >> > > elsewhere,
    > > >> > >> | that says page.validate, no control says

    > "causesvalidation=true",
    > > > and
    > > >> > > the
    > > >> > >> | AutoEventWireup is set to false. So I would think that the
    > > >> control's
    > > >> > >> | server event function would NOT execute, but it does execute

    > right
    > > >> > >> after
    > > >> > >> | page_load. I want to call page.validate (followed by if
    > > >> page.isvalid
    > > >> > >> ...)
    > > >> > >> | elsewhere, but that means that the event function code will

    run
    > > >> twice,
    > > >> > >> which
    > > >> > >> | I don't want.
    > > >> > >> |
    > > >> > >> | Where else do I look to see why the custom validator's event
    > > > function
    > > >> > >> is
    > > >> > >> | executing on the server after page_load?
    > > >> > >> |
    > > >> > >> |
    > > >> > >>
    > > >> > >>
    > > >> > >
    > > >> > >
    > > >> >
    > > >> >
    > > >>
    > > >>
    > > >
    > > >

    > >
    > >

    >
    >
     
    AFN, Dec 18, 2004
    #10
    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. johny
    Replies:
    5
    Views:
    431
    Karl Heinz Buchegger
    Apr 14, 2005
  2. Justin
    Replies:
    2
    Views:
    275
    Justin
    Oct 9, 2006
  3. Simon Mansfield

    Cant quite figure out whats wrong!? Help??

    Simon Mansfield, Dec 5, 2004, in forum: C Programming
    Replies:
    6
    Views:
    412
    Lawrence Kirby
    Dec 6, 2004
  4. Replies:
    2
    Views:
    3,313
    Ron Natalie
    Aug 11, 2006
  5. Nagaraj
    Replies:
    1
    Views:
    913
    Lionel B
    Mar 1, 2007
Loading...

Share This Page