Where in the page lifecycle does validation occur?

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default Where in the page lifecycle does validation occur?

    Hi all,

    I don't use auto postbacks on my web site to keep it javascript-free
    and browser agnostic. Whenever there's a postback to my page I'm using
    the Page_Load event to use the posted data for database updates.
    However, the page hasn't been validated at this point. I can call
    Validate() at this point, but this means the controls will be validated
    twice.

    At what point in the page lifecycle are the controls validated? When
    would be the best time and place to use the posted data for a database
    update, if not using auto postbacks? My current method doesn't seem
    ideal.

    Thanks in advance,

    Paul

    paul.hester@gmail.com Guest

  2. Similar Questions and Discussions

    1. problem with validation of css page
      Hi all why can't I validate this page with w3c, here is the page /* CSS Document */ @charset "iso-8859-1"; @media all { body { font-family:...
    2. Validators and Page validation
      My page is not receiving any validators that I have added to the page during PageIndexChanged event. If I call the same piece of code from some...
    3. Nested CompositeControls and page lifecycle
      Hey All - I'm working on a web site based on ASP.NET 2.0. Most of our major controls are based off a copy of CompositeControl (we have a base...
    4. When do the SOAPCLIENT_ERROR errors occur and how do resolve them
      HI, I have a funny problem. I have a VC++ client which is consuming a webservice. The VC++ client has been developed using VS .Net 2003 IDE. I...
    5. click event does not occur in webusercontrol
      I have EXACTLY the same problem - its a catch 22 which I've not yet found an answer to :o( You can't seem to attach events in PreRender (in fact it...
  3. #2

    Default Re: Where in the page lifecycle does validation occur?

    Hi,

    it happens just before postback events are raised (after Page_Load). In
    practise, if you have a Button on Page which triggers validation, it happens
    just before Button's Click event is raised. In the Button's Click event, you
    could then just check Page.IsValid.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]

    <paul.hester@gmail.com> wrote in message
    news:1156493116.533063.261110@b28g2000cwb.googlegr oups.com...
    > Hi all,
    >
    > I don't use auto postbacks on my web site to keep it javascript-free
    > and browser agnostic. Whenever there's a postback to my page I'm using
    > the Page_Load event to use the posted data for database updates.
    > However, the page hasn't been validated at this point. I can call
    > Validate() at this point, but this means the controls will be validated
    > twice.
    >
    > At what point in the page lifecycle are the controls validated? When
    > would be the best time and place to use the posted data for a database
    > update, if not using auto postbacks? My current method doesn't seem
    > ideal.
    >
    > Thanks in advance,
    >
    > Paul
    >

    Teemu Keiski Guest

  4. #3

    Default Re: Where in the page lifecycle does validation occur?

    Thanks Teemu,

    If I don't want to use button events (to avoid the need for javascript)
    where's the best place to check if the posted data is valid and do
    database updates, redirects etc.?

    Thanks,

    Paul

    Teemu Keiski wrote:
    > Hi,
    >
    > it happens just before postback events are raised (after Page_Load). In
    > practise, if you have a Button on Page which triggers validation, it happens
    > just before Button's Click event is raised. In the Button's Click event, you
    > could then just check Page.IsValid.
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > [url]http://blogs.aspadvice.com/joteke[/url]
    >
    > <paul.hester@gmail.com> wrote in message
    > news:1156493116.533063.261110@b28g2000cwb.googlegr oups.com...
    > > Hi all,
    > >
    > > I don't use auto postbacks on my web site to keep it javascript-free
    > > and browser agnostic. Whenever there's a postback to my page I'm using
    > > the Page_Load event to use the posted data for database updates.
    > > However, the page hasn't been validated at this point. I can call
    > > Validate() at this point, but this means the controls will be validated
    > > twice.
    > >
    > > At what point in the page lifecycle are the controls validated? When
    > > would be the best time and place to use the posted data for a database
    > > update, if not using auto postbacks? My current method doesn't seem
    > > ideal.
    > >
    > > Thanks in advance,
    > >
    > > Paul
    > >
    paul.hester@gmail.com Guest

  5. #4

    Default Re: Where in the page lifecycle does validation occur?

    Just before you need the data. generally you'd want to use events as they
    help in keeping the page code structure clean. Otherwise you have code
    centralized in one place trying to deal all cases.

    Note that Js validation isnt that bad, you have server-side validation
    backing it up in any case.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    [url]http://blogs.aspadvice.com/joteke[/url]


    <paul.hester@gmail.com> wrote in message
    news:1156545284.062367.229000@i3g2000cwc.googlegro ups.com...
    > Thanks Teemu,
    >
    > If I don't want to use button events (to avoid the need for javascript)
    > where's the best place to check if the posted data is valid and do
    > database updates, redirects etc.?
    >
    > Thanks,
    >
    > Paul
    >
    > Teemu Keiski wrote:
    >> Hi,
    >>
    >> it happens just before postback events are raised (after Page_Load). In
    >> practise, if you have a Button on Page which triggers validation, it
    >> happens
    >> just before Button's Click event is raised. In the Button's Click event,
    >> you
    >> could then just check Page.IsValid.
    >>
    >> --
    >> Teemu Keiski
    >> ASP.NET MVP, AspInsider
    >> Finland, EU
    >> [url]http://blogs.aspadvice.com/joteke[/url]
    >>
    >> <paul.hester@gmail.com> wrote in message
    >> news:1156493116.533063.261110@b28g2000cwb.googlegr oups.com...
    >> > Hi all,
    >> >
    >> > I don't use auto postbacks on my web site to keep it javascript-free
    >> > and browser agnostic. Whenever there's a postback to my page I'm using
    >> > the Page_Load event to use the posted data for database updates.
    >> > However, the page hasn't been validated at this point. I can call
    >> > Validate() at this point, but this means the controls will be validated
    >> > twice.
    >> >
    >> > At what point in the page lifecycle are the controls validated? When
    >> > would be the best time and place to use the posted data for a database
    >> > update, if not using auto postbacks? My current method doesn't seem
    >> > ideal.
    >> >
    >> > Thanks in advance,
    >> >
    >> > Paul
    >> >
    >

    Teemu Keiski Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139