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

  • Thread starter Greg Krzeszkowski
  • Start date
G

Greg Krzeszkowski

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
 
G

Greg Krzeszkowski

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?
 
P

Peter Blum

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: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top