This is a migrated thread and some comments may be shown as answers.

RadMenu with RadAjaxManager On Master Page Will Only Perform Full Page PostBacks.

1 Answer 147 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Christopher
Top achievements
Rank 1
Christopher asked on 22 Oct 2008, 10:45 PM
I have a RadMenu control and A Content Place Holder whithin a Masterpage. I have set up the Radmenus ItemClick Event and it does get fired, but I cannot get a partial page load. I always get a full page post back, what am I doing wrong.

Master Page HTML:

<%@ Master CodeBehind="SeastromPublic.master.cs" Inherits="Seastrommfg.MasterPages.SeastromPublic" EnableTheming="true" %>

<!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 id="PageHead" runat="server">
<title></title>
<!--[if lte IE 6]>
<script type="text/javascript" src="/JavaScript/supersleight-min.js"></script>
<![endif]-->
<asp:ContentPlaceHolder ID="head" runat="server" />
</head>
<body>
<form id="frmSeastromPublic" runat="server" defaultbutton="ibtnSearch" defaultfocus="ctl00_tbxSearch">
<asp:ScriptManager ID="ScriptManager1" runat="server"/>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadMenu" EventName="RadMenu_ItemClick">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="PageContent" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<!-- defaultbutton="ibtnSearch" defaultfocus="ctl00_tbxSearch" -->
<div id="divmain" class="main">
<div id="divheader" class="header">
<div id="divlogo" class="logo">
<telerik:RadCodeBlock ID="codeblock1" runat="server">
<a id="aLogo" class="logo" title="<% =XPathValue("anchor[@id=\"aLogo\"]/title") %>" href="<% =XPathValue("anchor[@id=\"aLogo\"]/url") %>">
<img id="imgLogo" class="logo" alt="<% =XPathValue("image[@id=\"imgLogo\"]/alt") %>" src="<% =XPathValue("image[@id=\"imgLogo\"]/url") %>" />
</a>
</telerik:RadCodeBlock>
</div>
<div id="divheaderform" class="headerform">
<div id="divheaderuser" class="headeruser">
<asp:HyperLink ID="hlLogin" CssClass="headerlink" runat="server" Enabled="true" EnableViewState="false" Visible="true" />
<asp:HyperLink ID="hlLogout" CssClass="headerlink" runat="server" Enabled="false" EnableViewState="false" Visible="false" />
<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
<% =XPathValue("text[@id=\"LogoDivider\"]") %>
</telerik:RadCodeBlock>
<asp:HyperLink ID="hlViewCart" CssClass="headerlink" runat="server" Enabled="true" EnableViewState="false" Visible="true" />
<telerik:RadCodeBlock ID="RadCodeBlock3" runat="server">
<% =XPathValue("text[@id=\"LogoDivider\"]") %>
</telerik:RadCodeBlock>
<asp:HyperLink ID="hlCheckOut" CssClass="headerlink" runat="server" Enabled="true" EnableViewState="false" Visible="true" />
</div>
<div id="divheadersearch" class="headersearch">
<span id="spanheadersearch" class="searchtext">
<telerik:RadCodeBlock ID="RadCodeBlock4" runat="server">
<% =XPathValue("text[@id=\"Search\"]") %>
</telerik:RadCodeBlock>
</span>
<div id="divsearchbox" class="searchbox">
<asp:TextBox ID="tbxSearch" CssClass="searchbox" runat="server" AutoCompleteType="Search" Enabled="true" Visible="true" MaxLength="18" />
</div>
<asp:ImageButton ID="ibtnSearch" CssClass="imgsearch" runat="server" Enabled="true" OnClick="ibtnSearch_Click" Visible="true" />
</div>
<div id="divheaderbanner" class="headerbanner">
<h1>
<telerik:RadCodeBlock ID="RadCodeBlock5" runat="server">
<% =XPathValue("text[@id=\"BannerHeader\"]") %>
</telerik:RadCodeBlock>
</h1>
</div>
</div>
</div>
<div id="divcontentwrapper" class="contentwrapper">
<div id="divmenuwrapper" class="menuwrapper">
<telerik:RadMenu ID="RadMenu" runat="server" CssClass="topmenu" OnItemClick="RadMenu_ItemClick" OnItemCreated="RadMenu_ItemCreated" CollapseAnimation="InOutBounce" CollapseDelay="200" EnableEmbeddedSkins="False" EnableViewState="true" />
</div>
<telerik:RadCodeBlock ID="RadCodeBlock11" runat="server">
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px">
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0px;" />
</telerik:RadAjaxLoadingPanel>
</telerik:RadCodeBlock>
<asp:ContentPlaceHolder ID="PageContent" runat="server" />
</div>
<div id="divbottom" class="bottom">
</div>
</div>
<!--<asp:XmlDataSource ID="TopMenuXMLDataSource" runat="server" DataFile="~/App_Data/WebSite.config" XPath="/webSite/pages/masterPages/seastromPublic.Master/menu/*/*[@display='true' and @displayTopMenu='true']" EnableViewState="False" />
<asp:XmlDataSource ID="LeftMenuDataSource" runat="server" DataFile="~/App_Data/WebSite.config" XPath="/webSite/pages/masterPages/seastromPublic.Master/menu/*/*/*[@display='true' and @displayRightMenu='true']" EnableViewState="False" />-->
</form>

<script language="JavaScript" src="<% =XPathValue("script[@id=\"webtraxs\"]/url") %>" type="text/javascript"></script>

<noscript>
<img alt="" src='<% =Server.UrlDecode( XPathValue("noscript[@id=\"webtraxs\"]/url")) %>' />
</noscript>
</body>
</html>

MASTERPAGE RELEVENT CODEBEHIND:
/// <summary>
/// Respondes to the Item Created event of the menu control.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RadMenu_ItemCreated( object sender, RadMenuEventArgs e )
{
bool val = true;

if ( e.Item.Attributes["Display"] != null )
{
if ( bool.TryParse( e.Item.Attributes["Display"].ToString( ).Trim( ), out val ) )
{
e.Item.Enabled = val;
e.Item.Visible = val;
}
}
}

/// <summary>
/// Respondes to the Item Clicked event of the menu control.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RadMenu_ItemClick( object sender, RadMenuEventArgs e )
{
RadAjaxManager1.Redirect( e.Item.Value.Trim( ) );
}


As a side note: Telerik Forum Editor is not rendering any of the images associated with the editor in IE7, Firefox, Safari, Chrome, etc.

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 27 Oct 2008, 07:38 AM
Hello Christopher,

I have examined the code snippet which you have sent and found that the postback is caused by the call to RadAjaxManager's Redirect method. Redirecting the response in such way is not possible on AjaxRequest and can lead to undesired behavior.

Regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Christopher
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or