Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Browser-History-Back Button

Reply
Thread Tools

Re: Browser-History-Back Button

 
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      08-15-2003
And I assume you'd like it to go back to the last page?
I suspect you're using Server.Transfer to change between pages.
If so, try changing to Response.Redirect instead. That will likely fix your
problem.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire


"szabelin" <szabelin@szabelin> wrote in message
news:041e01c3636f$979f1210$(E-Mail Removed)...
> Hello - I am having a problem with user clicking "back"
> button - it will always take them back to the start up
> page. Is there a setting that I didn't set? Thanks!



 
Reply With Quote
 
 
 
 
szabelin
Guest
Posts: n/a
 
      08-15-2003
No, I don't use Transfer or Redirect. My UI is similar to
that of ibuyspy. On each tab page I took this approach: I
have several large controls on page and I only show one
visible at a time. But when back is clicked - the thing
goes back to the first tab (the startup page) - always.

Thank you


>-----Original Message-----
>And I assume you'd like it to go back to the last page?
>I suspect you're using Server.Transfer to change between

pages.
>If so, try changing to Response.Redirect instead. That

will likely fix your
>problem.
>
>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net
>Developer for Hire
>
>
>"szabelin" <szabelin@szabelin> wrote in message
>news:041e01c3636f$979f1210$(E-Mail Removed)...
>> Hello - I am having a problem with user clicking "back"
>> button - it will always take them back to the start up
>> page. Is there a setting that I didn't set? Thanks!

>
>
>.
>

 
Reply With Quote
 
 
 
 
Steve C. Orr, MCSD
Guest
Posts: n/a
 
      08-15-2003
OIC.
Well you may need to keep track of which tab they are on, or maybe even a
history of all the tabs they've visited. A likely place to store this
information would be in Session State.
Then you can look in session state and see which tab you should take them
to.

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Developer for Hire


"szabelin" <szabelin@szabelin> wrote in message
news:059501c36374$ec590900$(E-Mail Removed)...
> No, I don't use Transfer or Redirect. My UI is similar to
> that of ibuyspy. On each tab page I took this approach: I
> have several large controls on page and I only show one
> visible at a time. But when back is clicked - the thing
> goes back to the first tab (the startup page) - always.
>
> Thank you
>
>
> >-----Original Message-----
> >And I assume you'd like it to go back to the last page?
> >I suspect you're using Server.Transfer to change between

> pages.
> >If so, try changing to Response.Redirect instead. That

> will likely fix your
> >problem.
> >
> >--
> >I hope this helps,
> >Steve C. Orr, MCSD
> >http://Steve.Orr.net
> >Developer for Hire
> >
> >
> >"szabelin" <szabelin@szabelin> wrote in message
> >news:041e01c3636f$979f1210$(E-Mail Removed)...
> >> Hello - I am having a problem with user clicking "back"
> >> button - it will always take them back to the start up
> >> page. Is there a setting that I didn't set? Thanks!

> >
> >
> >.
> >



 
Reply With Quote
 
szabelin
Guest
Posts: n/a
 
      08-15-2003

But IE's "back" button click does not cause postback...


>-----Original Message-----
>OIC.
>Well you may need to keep track of which tab they are on,

or maybe even a
>history of all the tabs they've visited. A likely place

to store this
>information would be in Session State.
>Then you can look in session state and see which tab you

should take them
>to.
>
>--
>I hope this helps,
>Steve C. Orr, MCSD
>http://Steve.Orr.net
>Developer for Hire
>
>
>"szabelin" <szabelin@szabelin> wrote in message
>news:059501c36374$ec590900$(E-Mail Removed)...
>> No, I don't use Transfer or Redirect. My UI is similar

to
>> that of ibuyspy. On each tab page I took this approach:

I
>> have several large controls on page and I only show one
>> visible at a time. But when back is clicked - the thing
>> goes back to the first tab (the startup page) - always.
>>
>> Thank you
>>
>>
>> >-----Original Message-----
>> >And I assume you'd like it to go back to the last page?
>> >I suspect you're using Server.Transfer to change

between
>> pages.
>> >If so, try changing to Response.Redirect instead. That

>> will likely fix your
>> >problem.
>> >
>> >--
>> >I hope this helps,
>> >Steve C. Orr, MCSD
>> >http://Steve.Orr.net
>> >Developer for Hire
>> >
>> >
>> >"szabelin" <szabelin@szabelin> wrote in message
>> >news:041e01c3636f$979f1210$(E-Mail Removed)...
>> >> Hello - I am having a problem with user

clicking "back"
>> >> button - it will always take them back to the start

up
>> >> page. Is there a setting that I didn't set? Thanks!
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
mathieu cupryk
Guest
Posts: n/a
 
      08-16-2003


Now I have a question about the server.transfer call.
Take for example the following.
How should I save all the values so I can store them when the user
presses the previous button.

What would be an approach for Button2_Click go to the third page of the
form And Button2_Previous goes to the first page. What would I need to
implement this process so The values are stored. What is the best way of
storing the values and making sure they repopulate when postback. Thanks
again. I enjoy your feedback.


void Button2_Click (object sender, ImageClickEventArgs e)
{
//textbox1 and textbox2 are webform
//controls
//Session["name"]=TextBox1.Text;
//Session["email"]=TextBox2.Text;
Server.Transfer("step3.aspx",true);
}

//************************************************** ********************
***********
void Button2_Previous (object sender, ImageClickEventArgs e)
{
//textbox1 and textbox2 are webform
//controls
//Session["name"]=TextBox1.Text;
//Session["email"]=TextBox2.Text;
Server.Transfer("step1.aspx",true);
}




<%@ Page Language="C#" EnableViewState="true" %>
<%@ Register TagPrefix="AU" Namespace="ActiveUp.WebControls"
Assembly="ActiveDateTime" %> <%@ Register TagPrefix="DH"
TagName="Copyright" Src="copyrightbar.ascx" %> <%@ import
Namespace="System" %> <%@ import Namespace="System.Net" %> <%@ import
Namespace="System.Data" %> <%@ import Namespace="System.Text" %> <%@
import Namespace="System.Xml" %> <%@ import
Namespace="System.Data.SqlClient" %> <%@ import
Namespace="System.Globalization" %> <%@ import
Namespace="System.Text.RegularExpressions" %> <script runat="server">


//************************************************** ********************
***********
// Define Page Load and initialize the control panels
public void Page_Load(object sender, System.EventArgs e)
{

if (!Page.IsPostBack)
{

// Create a new DataSet for Title
//***********************************************
DataSet myDataSetTitle = new DataSet();
// Read XML file and populate tables

myDataSetTitle.ReadXml(Server.MapPath("GeneralInfo rmation/titles.xml"));
// Data bind ListBox the shortcut way
txtTitle.DataSource =
myDataSetTitle.Tables["title"].DefaultView;
txtTitle.DataBind();


// Create a new DataSet for Gender
//***********************************************
DataSet myDataSetGender = new DataSet();
// Read XML file and populate tables

myDataSetGender.ReadXml(Server.MapPath("GeneralInf ormation/genders.xml")
);
// Data bind ListBox the shortcut way
txtGender.DataSource =
myDataSetGender.Tables["gender"].DefaultView;
txtGender.DataBind();


// Create a new DataSet for SecretWordType
//***********************************************
DataSet myDataSetSecretWordType = new DataSet();
// Read XML file and populate tables

myDataSetSecretWordType.ReadXml(Server.MapPath("Ge neralInformation/Secre
tWordTypes.xml"));
// Data bind ListBox the shortcut way
txtSecretWordType.DataSource =
myDataSetSecretWordType.Tables["secretwordtype"].DefaultView;
txtSecretWordType.DataBind();


// Create a new DataSet for States/Provinces
//***********************************************
DataSet myDataSetStateProvince = new DataSet();
// Read XML file and populate tables

myDataSetStateProvince.ReadXml(Server.MapPath("Gen eralInformation/statep
rovinces.xml"));
// Data bind ListBox the shortcut way
txtStateProvince.DataSource =
myDataSetStateProvince.Tables["stateprovince"].DefaultView;
txtStateProvince.DataBind();


// Create a new DataSet for Countries
//***********************************************
DataSet myDataSetCountry = new DataSet();
// Read XML file and populate tables

myDataSetCountry.ReadXml(Server.MapPath("GeneralIn formation/countries.xm
l"));
// Data bind ListBox the shortcut way
txtCountry.DataSource =
myDataSetCountry.Tables["country"].DefaultView;
txtCountry.DataBind();
}



}


//************************************************** ********************
***********
void Button2_Click (object sender, ImageClickEventArgs e)
{
//textbox1 and textbox2 are webform
//controls
//Session["name"]=TextBox1.Text;
//Session["email"]=TextBox2.Text;
Server.Transfer("step3.aspx",true);
}

//************************************************** ********************
***********
void Button2_Previous (object sender, ImageClickEventArgs e)
{
//textbox1 and textbox2 are webform
//controls
//Session["name"]=TextBox1.Text;
//Session["email"]=TextBox2.Text;
Server.Transfer("step13.aspx",true);
}

//************************************************** ********************
***********
void txtTitle_SelectedIndexChanged(object sender, EventArgs e)
{

}

void Copyright1_Load(object sender, EventArgs e) {

}

void txtFirstName_TextChanged(object sender, EventArgs e) {

}

</script>
<html>
<head>
<title></title>
<link href="Style.css" type="text/css" rel="stylesheet" /> </head>
<body text="#000000" vlink="#330000" alink="#660000" link="#600000"
bgcolor="#000000">
<table style="WIDTH: 960px; HEIGHT: 103px" cellspacing="0"
cellpadding="0" width="960" bgcolor="#000000" border="0">
<tbody>
<tr>
<td width="100%" height="8">
</td>
</tr>
</tbody>
</table>
<!-- Nav Begins Here -->
<!-- /Nav -->
<!-- Body Content -->
<table style="WIDTH: 960px; HEIGHT: 70px" cellspacing="0"
cellpadding="0" width="960" background="linebg.gif" border="0">
<tbody>
<tr>
<td width="100%" height="10">
</td>
</tr>
</tbody>
</table>
<table style="WIDTH: 960px; HEIGHT: 1028px" cellspacing="0"
cellpadding="10" width="960" bgcolor="#ffffff" border="0">
<tbody>
<tr>
<td width="10" background="linebg.gif" rowspan="3">
<img style="WIDTH: 62px; HEIGHT: 10px" height="10"
src="spacer.gif" width="96" border="0" /></td>
<td align="middle">
<table style="WIDTH: 639px; HEIGHT: 198px"
cellspacing="0" cellpadding="0" align="center" border="0">
<tbody>
<tr>
<td align="right" width="170"
height="167">
<img style="WIDTH: 173px; HEIGHT:
149px" height="161" hspace="10" src="images/blow.jpg" width="150"
border="0" /></td>
<td width="534" height="167">
<font face="Times New Roman, Times,
Garamond" color="#600000" size="5"><b><i>Everyone
knows that love is
timeless.</i></b></font>
<br />
<font face="Verdana"
size="2">Nevertheless, like many good things, it deserves recognition.
No time like the present! Any day is
the right day to show that certain someone the
'spark' is still there.
<p>
For more than a century now,
Freixenet has been the ideal choice. The world's favorite
sparkling wine. It's perfect for
that rarest and most special of all occasionsthe
two of you.
</p>
</font></td>
</tr>
</tbody>
</table>
<p align="center">
<img height="23" src="images/starbar.gif"
width="300" vspace="3" border="0" />
</p>
</td>
<td width="10" background="linebg.gif" rowspan="3">
<img style="WIDTH: 66px; HEIGHT: 10px" height="10"
src="spacer.gif" width="10" border="0" /></td>
</tr>
<tr>
<td rowspan="2">
<table style="WIDTH: 717px; HEIGHT: 60px"
cellspacing="0" cellpadding="0" width="717" align="center"
bgcolor="#ffffff" border="2">
<tbody>
<tr>
<td align="middle" width="100%"
bgcolor="#c8bbbe" height="50">
<font face="MS Sans Serif"
color="#ffffff" size="2"><big><big>PERSONAL INFORMATION
!</big></big></font></td>
</tr>
</tbody>
</table>
<table style="WIDTH: 736px; HEIGHT: 404px"
cellspacing="0" cellpadding="0" width="736" align="center">
<tbody>
<form runat="server">
<tr>
<td colspan="0" rowspan="0"
border="0">
<table style="WIDTH: 717px;
HEIGHT: 411px" bordercolor="#c8bbbe" align="center" bgcolor="#fdeef4"
border="2">
<tbody>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<p align="left">
<strong>
<asp:Image
id="Image3" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>Title:</strong></strong>
</p>
</td>
<td width="520"
colspan="3">
<asp:listbox
id="txtTitle" runat="server"
OnSelectedIndexChanged="txtTitle_SelectedIndexChan ged"
DataValueField="text" DataTextField="value" Rows="1"></asp:listbox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image1" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>First Name:</strong>
</p>
</strong></td>
<td width="520"
colspan="3">
<p>
<asp:TextBox
id="txtFirstName" runat="server" maxlength="60" width="150px"
OnTextChanged="txtFirstName_TextChanged"></asp:TextBox>

&nbsp;<asp:RequiredFieldValidator id="txtFirstNameReqVal" runat="server"
ControlToValidate="txtFirstName" ErrorMessage="Please enter your first
name." Display="Dynamic" Font-Size="8pt" Font-Name="Verdana"
Font-Names="Verdana"></asp:RequiredFieldValidator>
<!--
************************ -->
<!-- Check
if FirstName has a certain number of characters -->

<asp:RegularExpressionValidator id="txtFirstNameRegexVal" runat="server"
ControlToValidate="txtFirstName" ErrorMessage="Please enter your first
name." Display="Dynamic" Font-Size="8pt" Font-Name="Verdana"
Font-Names="Verdana"
ValidationExpression="[a-zA-Z]{2,}"></asp:RegularExpressionValidator>

<strong></strong>
</p>
</td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image2" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>
<strong>Last
Name:</strong>
</p>
</strong></td>
<td width="520"
colspan="3">
<p>
<asp:TextBox
id="txtLastName" runat="server" maxlength="60"
width="150px"></asp:TextBox>

&nbsp;<asp:RequiredFieldValidator id="txtLastNameReqVal" runat="server"
ControlToValidate="txtLastName" ErrorMessage="Please enter your last
name." Display="Dynamic" Font-Size="8pt" Font-Name="Verdana"
Font-Names="Verdana"></asp:RequiredFieldValidator>

&nbsp;<asp:RegularExpressionValidator id="txtLastNameRegexVal"
runat="server" ControlToValidate="txtLastName" ErrorMessage="Please
enter your last name." Display="Dynamic" Font-Size="8pt"
Font-Name="Verdana" Font-Names="Verdana"
ValidationExpression="[a-zA-Z]{2,}"></asp:RegularExpressionValidator>

<strong></strong>
</p>
</td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<p align="left">
<strong>
<asp:Image
id="Image5" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>Gender:</strong></strong>
</p>
</td>
<td width="520"
colspan="3">
<asp:listbox
id="txtGender" runat="server" DataValueField="text"
DataTextField="value" Rows="1"></asp:listbox>

<strong></strong></td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image6" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>
<asp:Label
id="BirthDate" runat="server"> </asp:Label><strong>Date of
Birth:</strong>
</p>
</strong></td>
<td nowrap="nowrap"
width="520" colspan="3">
<div
align="left">

<AU:ACTIVEDATETIME id="BirthDateSelector" runat="server"
BaseStyle-BackColor="#F0F0F0" DateStyle-Font-Name="Arial" Format="month;
/ ;day; / ;year"></AU:ACTIVEDATETIME>
</div>
</td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image7" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>Secret Question:</strong>
</p>
</strong></td>
<td width="520"
colspan="3">
<asp:listbox
id="txtSecretWordType" runat="server" DataValueField="text"
DataTextField="value" Rows="1"></asp:listbox>

<strong></strong></td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image8" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>Secret Answer: </strong>
</p>
</strong></td>
<td width="520"
colspan="3">
<asp:TextBox
id="txtSecretWord" runat="server" maxlength="60"
width="200px"></asp:TextBox>
<!--
*************************** -->
<!-- Check if
Secret Word is empty -->

<asp:RequiredFieldValidator id="txtSecretWordReqVal" runat="server"
ControlToValidate="txtSecretWord" ErrorMessage="Secret Word must be at
least 3 characters." Display="Dynamic" Font-Size="8pt"
Font-Name="Verdana" Font-Names="Verdana"></asp:RequiredFieldValidator>
<!--
***************************** -->
<!-- Verify
Secret Word -->

<asp:RegularExpressionValidator id="txtSecretWordRegexVal"
runat="server" ControlToValidate="txtSecretWord" ErrorMessage="Secret
Word must be at least 3 characters." Display="Dynamic" Font-Size="8pt"
Font-Name="Verdana" Font-Names="Verdana"
ValidationExpression="^([1-zA-Z0-1@.\s]{1,255})$"></asp:RegularExpressio
nValidator>
</td>
</tr>
<tr>
<td nowrap="nowrap"
align="middle" width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image9" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>City/Town/Village:</strong>
</p>
</strong></td>
<td width="520"
colspan="3">
<asp:TextBox
id="txtCity" runat="server" maxlength="60" width="200px"></asp:TextBox>
<!--
******************** -->
<!-- Check if
City is empty -->

<asp:RequiredFieldValidator id="txtCityReqVal" runat="server"
ControlToValidate="txtCity" ErrorMessage="Please enter your city."
Display="Dynamic" Font-Size="8pt" Font-Name="Verdana"
Font-Names="Verdana"></asp:RequiredFieldValidator>
<!--
********************** -->
<!-- Verify City
-->

<asp:RegularExpressionValidator id="txtCityRegexVal" runat="server"
ControlToValidate="txtCity" ErrorMessage="Please enter your city."
Display="Dynamic" Font-Size="8pt" Font-Name="Verdana"
Font-Names="Verdana"
ValidationExpression="^([1-zA-Z0-1@.\s]{1,255})$"></asp:RegularExpressio
nValidator>

<strong></strong></td>
</tr>
<tr>
<td width="187">
<asp:Image
id="Image10" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>
<strong><font
style="FONT-SIZE: 9pt"
face="Verdana">State/Province/Region:</font></strong></td>
<td width="520"
colspan="3">
<asp:listbox
id="txtStateProvince" runat="server" DataValueField="text"
DataTextField="value" Rows="1"></asp:listbox>
</td>
</tr>
<tr>
<td width="187">
<strong>
<p align="left"
height="20">
<asp:Image
id="Image11" runat="server"
ImageUrl="images\starsmallfull.gif"></asp:Image>

<strong>Country:</strong>&nbsp;
</p>
</strong></td>
<td width="520"
colspan="3">
<asp:listbox
id="txtCountry" runat="server" DataValueField="text"
DataTextField="value" Rows="1"></asp:listbox>
</td>
</tr>
<tr>
<td align="middle"
width="187">
<input
id="InputImage4" onmouseover="this.src='images/previous_on.gif';"
style="BORDER-RIGHT: white thin ridge; BORDER-TOP: white thin ridge;
BORDER-LEFT: white thin ridge; BORDER-BOTTOM: white thin ridge"
onmouseout="this.src='images/previous.gif';" type="image"
src="images/previous.gif" runat="server"
onserverclick="Button2_Previous" /></td>
<td width="520"
colspan="3">
<input
id="InputImage3" onmouseover="this.src='images/next_on.gif';"
style="BORDER-RIGHT: white thin ridge; BORDER-TOP: white thin ridge;
BORDER-LEFT: white thin ridge; BORDER-BOTTOM: white thin ridge"
onmouseout="this.src='images/next.gif';" type="image" height="26"
width="60" src="images/next.gif" runat="server"
onserverclick="Button2_Click" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</form>
</tbody>
</table>
<p align="right">
<span class="Page"><b><font face="Times New
Roman" size="3">Page 2 of&nbsp; 6 &nbsp;&nbsp;
&nbsp;&nbsp; </font></b></span>
</p>
<p align="center">
<img height="23" src="images/starbar.gif"
width="300" vspace="3" border="0" />&nbsp;
</p>
</td>
</tr>
<tr>
</tr>
</tbody>
</table>
<!-- /Body Content -->
<table style="WIDTH: 960px; HEIGHT: 35px" cellspacing="0"
cellpadding="0" width="960" background="linebg.gif" border="0">
<tbody>
<tr>
<td width="100%" height="10">
<img style="WIDTH: 38px; HEIGHT: 35px" height="10"
src="spacer.gif" width="7" border="0" /></td>
</tr>
</tbody>
</table>
<center>
<p>
</p>
</center>
<center>
<p>
</p>
</center>
</body>
</html>


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Image button acting like submit button. Russell ASP .Net 3 06-24-2004 01:55 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM
HTML Reset Button Doesn't work after postback with Submit button Chris Lane ASP .Net 4 11-17-2003 11:52 PM
JavaScript Access to Button in form tags (webcontrol or html button) Wes Weems ASP .Net 1 07-20-2003 05:27 AM



Advertisments