Below is some code from a very simple test app that is similar to the architecture of my application. The RadScriptManager is in a master page and with a textbox and button in a user control.
When I place the textbox and button inside an UpdatePanel the Ajax EnableHistory works but the same code does not work with RadAjaxPanel. I have also tried using RadAjaxManager which also does not work. History points are added successfully using RadAjaxPanel and the ScriptManagerProxy.Navigate fires, but the textbox is not updated.
UpdatePanel has an Update method to force an update when its UpdateMode is Conditional but RadAjaxPanel does not have an Update method which is probably why UpdatePanel works.
What can I do to get the EnableHistory feature to work with RadAjaxPanel?
Thanks
Nate
Main.Master
<%
@ Master Language="VB" AutoEventWireup="false" CodeBehind="Main.master.vb" Inherits="AjaxEnableHistory.Main" %>
<!
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></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</
head>
<
body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="scriptMgr" runat="server" EnableHistory="True" />
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</
body>
</
html>
Default.aspx
<%
@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Main.Master" CodeBehind="Default.aspx.vb" Inherits="AjaxEnableHistory._Default" %>
<%
@ Register Src="Default.ascx" TagName="Default" TagPrefix="uc1" %>
<
asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<uc1:Default ID="Default1" runat="server" />
</
asp:Content>
Default.ascx
<%
@ Control Language="vb" AutoEventWireup="false" CodeBehind="Default.ascx.vb" Inherits="AjaxEnableHistory._Default1" %>
<
asp:ScriptManagerProxy ID="scriptMgr" runat="server" />
<%
--<telerik:RadAjaxLoadingPanel ID="ajxLoading" runat="server">
Loading...</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="ajxPanel" runat="server" LoadingPanelID="ajxLoading">
<telerik:RadTextBox ID="txt" runat="server" />
<asp:Button ID="btn" runat="server" Text="Ajax Postback" />
</telerik:RadAjaxPanel>--
%>
<
asp:UpdateProgress ID="updProgress" runat="server" AssociatedUpdatePanelID="updPanel">
<ProgressTemplate>Loading...</ProgressTemplate>
</
asp:UpdateProgress>
<
asp:UpdatePanel ID="updPanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<telerik:RadTextBox ID="txt" runat="server" />
<asp:Button ID="btn" runat="server" Text="Ajax Postback" />
</ContentTemplate>
</
asp:UpdatePanel>
Default.ascx.vb
Private
Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
Threading.Thread.Sleep(3000)
AddHistoryPoint()
End Sub
Private Sub scriptMgr_Navigate(ByVal sender As Object, ByVal e As System.Web.UI.HistoryEventArgs) Handles scriptMgr.Navigate
Threading.Thread.Sleep(3000)
txt.Text = e.State(txt.ID)
updPanel.Update() 'Update method not available with RadAjaxPanel
End Sub
Protected Sub AddHistoryPoint()
Dim sm As ScriptManager = ScriptManager.GetCurrent(Me.Page)
If sm.IsInAsyncPostBack AndAlso Not sm.IsNavigating Then
Dim state As New NameValueCollection()
state(txt.ID) = txt.Text
ScriptManager.GetCurrent(
Me.Page).AddHistoryPoint(state, "Test Title")
End If
End Sub