Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

Ajax + Browser history

$
0
0

I am following the Managing Browser History asp.net example article but I have a problem with updating the **LabelHistoryData** label after clicking the browser back button. I placed a breakpoint at

LabelHistoryData.Text = Server.HtmlEncode(e.State["s"]);

but somehow after clicking btnGetInboxList or btnGetSentboxList follow by the browser back button, the LabelHistoryData.Text value is always null. Below is a portion of my code. Someone please kindly advice.

Thanks.

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" OnNavigate="OnNavigateHistory" EnableHistory="true" EnableSecureHistoryState="false" /> <asp:UpdatePanel ID="uiupInboxMainGrid" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:Label runat="server" ID="LabelHistoryData" /><asp:Button ID="btnGetMessageContent" runat="server" Text="MsgContent" OnClick="GetMessageContent_Click" /><asp:Button ID="btnGetInboxList" runat="server" Text="Inbox" OnClick="GetInboxList_Click"/><asp:Button ID="btnGetSentboxList" runat="server" Text="OutBox" OnClick="GetSentBoxList_Click" /></ContentTemplate></asp:UpdatePanel>


public void OnNavigateHistory(object sender, HistoryEventArgs e)
{
LabelHistoryData.Text = Server.HtmlEncode(e.State["s"]);

}

protected void GetInboxList_Click(object sender, EventArgs e)
{
LabelHistoryData.Text = ((Button)sender).Text;
ScriptManager.GetCurrent(this).AddHistoryPoint("s", LabelHistoryData.Text, "Entry: " + LabelHistoryData.Text);
}

protected void GetSentBoxList_Click(object sender, EventArgs e)
{
LabelHistoryData.Text = ((Button)sender).Text;
ScriptManager.GetCurrent(this).AddHistoryPoint("s", LabelHistoryData.Text, "Entry: " + LabelHistoryData.Text);
}

protected void GetMessageContent_Click(object sender, EventArgs e)
{
LabelHistoryData.Text = ((Button)sender).Text;
ScriptManager.GetCurrent(this).AddHistoryPoint("s", LabelHistoryData.Text, "Entry: " + LabelHistoryData.Text);
}




Viewing all articles
Browse latest Browse all 5678

Trending Articles