
Felipe Saldana
Top achievements
Rank 1
Felipe Saldana
asked on 29 Jun 2009, 05:59 PM
I am having a problem when the browser back button is clicked after I have added multiple History points.
I have a multiview in a user control. The page that contains the user control uses a master page.
The multview has 4 basic steps "Select", "Billing", "Shipping", "Confirmation".
"Select" = 0
"Billing" = 1
"Shipping" = 2
"Confirmation" = 3
As the user steps through the view I add history points for the current view before I change to the next view.
The URL gets displayed correctly in the browser: ordering.aspx#&&mykey=0, ordering.aspx#&&mykey=1, ordering.aspx#&&mykey=2
When the user clicks the browser back button on the "Confirmation" view..... I capture the OnNavigate event for the ScriptManager but my key states the value of "1".
The url states the value should be "2" but the event in the code behind states "1".
Any one have any ideas on what could be going on here?
It is possible for me to get the value directly from the URL since that is correct?
Thanks,
Felipe
I have a multiview in a user control. The page that contains the user control uses a master page.
The multview has 4 basic steps "Select", "Billing", "Shipping", "Confirmation".
"Select" = 0
"Billing" = 1
"Shipping" = 2
"Confirmation" = 3
As the user steps through the view I add history points for the current view before I change to the next view.
scriptManager.AddHistoryPoint("mykey", Convert.ToString(this.mvSignOrdering.ActiveViewIndex)); |
this.mvOrdering.ActiveViewIndex = 1; |
The URL gets displayed correctly in the browser: ordering.aspx#&&mykey=0, ordering.aspx#&&mykey=1, ordering.aspx#&&mykey=2
When the user clicks the browser back button on the "Confirmation" view..... I capture the OnNavigate event for the ScriptManager but my key states the value of "1".
The url states the value should be "2" but the event in the code behind states "1".
Any one have any ideas on what could be going on here?
It is possible for me to get the value directly from the URL since that is correct?
Thanks,
Felipe
4 Answers, 1 is accepted
0

Felipe Saldana
Top achievements
Rank 1
answered on 29 Jun 2009, 07:46 PM
I have put together some test code that has the same behavior.
If I step through the process the the last view and then hit the brower back button when I debug and view the contents of
e.State .....the value is 1 while I expect it to be 2.
Also, just for testing, I added another test history point "myKeyAgain". The test key displays in the URL but is not available when the browser back button is clicked.
http://localhost/testBackButton.aspx#&&mykeyAgain=2&mykey=2
If I step through the process the the last view and then hit the brower back button when I debug and view the contents of
e.State .....the value is 1 while I expect it to be 2.
Also, just for testing, I added another test history point "myKeyAgain". The test key displays in the URL but is not available when the browser back button is clicked.
http://localhost/testBackButton.aspx#&&mykeyAgain=2&mykey=2
<%@ Page Language="C#" %> |
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<%@ Import Namespace = "baseContentManagementFramework.Common" %> |
<script runat="server"> |
void Page_Load(Object Sender, EventArgs e) |
{ |
} |
void btnToView1_Click(object sender, EventArgs e) |
{ |
addHistory(); |
changeView(1); |
} |
void btnToView2_Click(object sender, EventArgs e) |
{ |
addHistory(); |
changeView(2); |
} |
void btnToView3_Click(object sender, EventArgs e) |
{ |
addHistory(); |
scriptManager.AddHistoryPoint("mykeyAgain", "2"); |
changeView(3); |
} |
void changeView(int viewIndex) |
{ |
this.mv.ActiveViewIndex = viewIndex; |
//RadAjaxManager1.RaisePostBackEvent(viewIndex.ToString()); |
} |
void addHistory() |
{ |
scriptManager.AddHistoryPoint("mykey", Convert.ToString(this.mv.ActiveViewIndex)); |
} |
private void historyNavigate(object sender, System.Web.UI.HistoryEventArgs e) |
{ |
int i = 0; |
i++; |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
this.mv.ActiveViewIndex = Convert.ToInt32(e.Argument); |
} |
</script> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="scriptManager" runat="server" EnableHistory="true" OnNavigate="historyNavigate" EnableSecureHistoryState="false"></asp:ScriptManager> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableHistory="true" OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="btnToView1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnToView2"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnToView3"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<div> |
<asp:Panel ID="panelUpdateAllViews" runat="server"> |
<asp:MultiView ID="mv" runat="server" ActiveViewIndex="0"> |
<asp:View ID="View0" runat="server">View 0 |
<asp:Button ID="btnToView1" runat="server" Text="To View 1" OnClick="btnToView1_Click" /> |
</asp:View> |
<asp:View ID="View1" runat="server">View 1 |
<asp:Button id="btnToView2" runat="server" Text="To View 2" OnClick="btnToView2_Click" /> |
</asp:View> |
<asp:View ID="View2" runat="server">View 2 |
<asp:Button ID="btnToView3" runat="server" Text="To View 3" OnClick="btnToView3_Click" /> |
</asp:View> |
<asp:View ID="View3" runat="server">View 3</asp:View> |
</asp:MultiView> |
</asp:Panel> |
</div> |
</form> |
</body> |
</html> |
0
Hi Felipe,
Please find our answer to your questions in the support ticket of yours.
I hope this helps.
Greetings,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Please find our answer to your questions in the support ticket of yours.
I hope this helps.
Greetings,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

Sunil Kaim
Top achievements
Rank 1
answered on 23 Feb 2010, 06:47 PM
I also need the solution for...
"How back button would work"
And also posted the question in my account. But nobody is replying there.
"How back button would work"
And also posted the question in my account. But nobody is replying there.
0

Felipe Saldana
Top achievements
Rank 1
answered on 23 Feb 2010, 11:02 PM
Here's what support sent me a while back; it is based on the code I posted months ago...I assume it still works:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="HistoryPoints.aspx.cs" Inherits="HistoryPoints" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="scriptManager" runat="server" EnableHistory="true" OnNavigate="historyNavigate" |
EnableSecureHistoryState="false"> |
</asp:ScriptManager> |
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableHistory="false" |
OnAjaxRequest="RadAjaxManager1_AjaxRequest"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="btnToView1"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnToView2"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="btnToView3"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
<telerik:AjaxSetting AjaxControlID="scriptManager"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="mv" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManager> |
<div> |
<asp:Panel ID="panelUpdateAllViews" runat="server"> |
<asp:MultiView ID="mv" runat="server" ActiveViewIndex="0"> |
<asp:View ID="View0" runat="server"> |
View 0 |
<asp:Button ID="btnToView1" runat="server" Text="To View 1" OnClick="btnToView1_Click" /> |
</asp:View> |
<asp:View ID="View1" runat="server"> |
View 1 |
<asp:Button ID="btnToView2" runat="server" Text="To View 2" OnClick="btnToView2_Click" /> |
</asp:View> |
<asp:View ID="View2" runat="server"> |
View 2 |
<asp:Button ID="btnToView3" runat="server" Text="To View 3" OnClick="btnToView3_Click" /> |
</asp:View> |
<asp:View ID="View3" runat="server"> |
View 3</asp:View> |
</asp:MultiView> |
</asp:Panel> |
</div> |
</form> |
</body> |
</html> |
using System; |
using System.Data; |
using System.Configuration; |
using System.Collections; |
using System.Web; |
using System.Web.Security; |
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class HistoryPoints : System.Web.UI.Page |
{ |
protected void Page_Load(Object Sender, EventArgs e) |
{ |
} |
protected void btnToView1_Click(object sender, EventArgs e) |
{ |
changeView(1); |
addHistory(); |
} |
protected void btnToView2_Click(object sender, EventArgs e) |
{ |
changeView(2); |
addHistory(); |
} |
protected void btnToView3_Click(object sender, EventArgs e) |
{ |
//scriptManager.AddHistoryPoint("mykeyAgain", "2"); |
changeView(3); |
addHistory(); |
} |
protected void changeView(int viewIndex) |
{ |
this.mv.ActiveViewIndex = viewIndex; |
//RadAjaxManager1.RaisePostBackEvent(viewIndex.ToString()); |
} |
protected void addHistory() |
{ |
scriptManager.AddHistoryPoint("mykey", Convert.ToString(this.mv.ActiveViewIndex)); |
} |
protected void historyNavigate(object sender, System.Web.UI.HistoryEventArgs e) |
{ |
if (!string.IsNullOrEmpty(e.State["mykey"])) |
{ |
string point = e.State["mykey"]; |
mv.ActiveViewIndex = Convert.ToInt32(point); |
} |
else |
{ |
mv.ActiveViewIndex = 0; |
} |
} |
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
this.mv.ActiveViewIndex = Convert.ToInt32(e.Argument); |
} |
} |