Issues with navigating to previous page and keeping custom page properties available

Discussion in 'ASP .Net' started by Greg Krzeszkowski, Mar 2, 2005.

  1. Hi,

    This might be a little odd but I need to implement a back/"return to
    previous page" function from different pages within my asp.net
    application. The page the back button on has a property that stores
    an id value that the page i will be returning to will require to
    display data. The entire application does not use querystrings, and
    I don't want to use session variables to store this value.

    The page also has controls that require validation (that a value
    exists, numeric etc). If the back button is created and has
    CausesValidation set to True, I obviously get validation errors.

    If the back button has CausesValidation set to false, the property on
    the page is automatically destroyed.

    Is there a way to implement my back functionality without resorting to
    querystring or session variables?

    Cheers

    Greg
     
    Greg Krzeszkowski, Mar 2, 2005
    #1
    1. Advertising

  2. Greg Krzeszkowski

    Peter Blum Guest

    Have you tried the properties: CommandName and CommandArg on the button? For
    example: CommandName="Back" and CommandArg= the ID. Then setup the OnCommand
    event handler to intercept this click.

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

    "Greg Krzeszkowski" <> wrote in message
    news:...
    > Hi,
    >
    > This might be a little odd but I need to implement a back/"return to
    > previous page" function from different pages within my asp.net
    > application. The page the back button on has a property that stores
    > an id value that the page i will be returning to will require to
    > display data. The entire application does not use querystrings, and
    > I don't want to use session variables to store this value.
    >
    > The page also has controls that require validation (that a value
    > exists, numeric etc). If the back button is created and has
    > CausesValidation set to True, I obviously get validation errors.
    >
    > If the back button has CausesValidation set to false, the property on
    > the page is automatically destroyed.
    >
    > Is there a way to implement my back functionality without resorting to
    > querystring or session variables?
    >
    > Cheers
    >
    > Greg
     
    Peter Blum, Mar 2, 2005
    #2
    1. Advertising

  3. Hi Peter,

    I've tried your suggestion - the validators still display, overriding
    everything.

    I did the following (just to confirm):

    <asp:button id="btnBack" runat="server" CssClass="size60button"
    Width="60px" Text="Back" CommandName="Back" CommandArgument="btnBack"
    onCommand="CommandBtn_Click"></asp:button>


    Sub CommandBtn_Click(ByVal sender As Object, ByVal e As
    CommandEventArgs)
    End Sub


    Am I missing something?


    "Peter Blum" <> wrote in message news:<>...
    > Have you tried the properties: CommandName and CommandArg on the button? For
    > example: CommandName="Back" and CommandArg= the ID. Then setup the OnCommand
    > event handler to intercept this click.
    >
    > --- Peter Blum
    > www.PeterBlum.com
    > Email:
    > Creator of "Professional Validation And More" at
    > http://www.peterblum.com/vam/home.aspx
    >
    > "Greg Krzeszkowski" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > This might be a little odd but I need to implement a back/"return to
    > > previous page" function from different pages within my asp.net
    > > application. The page the back button on has a property that stores
    > > an id value that the page i will be returning to will require to
    > > display data. The entire application does not use querystrings, and
    > > I don't want to use session variables to store this value.
    > >
    > > The page also has controls that require validation (that a value
    > > exists, numeric etc). If the back button is created and has
    > > CausesValidation set to True, I obviously get validation errors.
    > >
    > > If the back button has CausesValidation set to false, the property on
    > > the page is automatically destroyed.
    > >
    > > Is there a way to implement my back functionality without resorting to
    > > querystring or session variables?
    > >
    > > Cheers
    > >
    > > Greg
     
    Greg Krzeszkowski, Mar 3, 2005
    #3
  4. Greg Krzeszkowski

    Peter Blum Guest

    Greg, you omitted CausesValidation=false. You said you don't want to
    validate.
    Validation will not fire unless Page.Validate() is called. On buttons that
    have CausesValidation=true, they internally call Page.Validate() just before
    calling their Click event. Its actually called within their OnClick method.
    All other times, you must call Page.Validate() yourself. So if its
    validating, its due to the control having CausesValidation=true.

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

    "Greg Krzeszkowski" <> wrote in message
    news:...
    > Hi Peter,
    >
    > I've tried your suggestion - the validators still display, overriding
    > everything.
    >
    > I did the following (just to confirm):
    >
    > <asp:button id="btnBack" runat="server" CssClass="size60button"
    > Width="60px" Text="Back" CommandName="Back" CommandArgument="btnBack"
    > onCommand="CommandBtn_Click"></asp:button>
    >
    >
    > Sub CommandBtn_Click(ByVal sender As Object, ByVal e As
    > CommandEventArgs)
    > End Sub
    >
    >
    > Am I missing something?
    >
    >
    > "Peter Blum" <> wrote in message
    > news:<>...
    >> Have you tried the properties: CommandName and CommandArg on the button?
    >> For
    >> example: CommandName="Back" and CommandArg= the ID. Then setup the
    >> OnCommand
    >> event handler to intercept this click.
    >>
    >> --- Peter Blum
    >> www.PeterBlum.com
    >> Email:
    >> Creator of "Professional Validation And More" at
    >> http://www.peterblum.com/vam/home.aspx
    >>
    >> "Greg Krzeszkowski" <> wrote in message
    >> news:...
    >> > Hi,
    >> >
    >> > This might be a little odd but I need to implement a back/"return to
    >> > previous page" function from different pages within my asp.net
    >> > application. The page the back button on has a property that stores
    >> > an id value that the page i will be returning to will require to
    >> > display data. The entire application does not use querystrings, and
    >> > I don't want to use session variables to store this value.
    >> >
    >> > The page also has controls that require validation (that a value
    >> > exists, numeric etc). If the back button is created and has
    >> > CausesValidation set to True, I obviously get validation errors.
    >> >
    >> > If the back button has CausesValidation set to false, the property on
    >> > the page is automatically destroyed.
    >> >
    >> > Is there a way to implement my back functionality without resorting to
    >> > querystring or session variables?
    >> >
    >> > Cheers
    >> >
    >> > Greg
     
    Peter Blum, Mar 3, 2005
    #4
    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. Nathan Sokalski
    Replies:
    0
    Views:
    957
    Nathan Sokalski
    Oct 17, 2005
  2. Samy
    Replies:
    0
    Views:
    551
  3. Harlan Messinger
    Replies:
    0
    Views:
    389
    Harlan Messinger
    Feb 18, 2008
  4. Nathan Sokalski
    Replies:
    0
    Views:
    229
    Nathan Sokalski
    Oct 17, 2005
  5. steve king
    Replies:
    0
    Views:
    232
    steve king
    Sep 4, 2003
Loading...

Share This Page