Error when using RadScriptManager in Template
Hi there,
Hello Phill Hodgkinson,
Thank you for using our services.
Can you please tell us a little bit more about your project - localization setup for example, we have not been able to reproduce the issue by following the steps.
We are currently making the Sitefinity pages automatically inject a ScirptManager if you have controls that require a script manager. You set the control to require a script manager using [RequireScriptManager] attribuge at the control's class definition (decorate the class with this attribute). This is how Sitefinity currently works. This means that you will not need to put a ScriptManager on the master page as long as your controls use this attribute.
The current behavior is working with the ASP.NET ScriptManager. Our next weekly release will include RadScriptmanager. Our page will work with the RadScriptManager by default and will utilize all of its performance optimization techniques - script combining, script compression, etc.
Greetings,
Radoslav Georgiev
the Telerik team
Hi Radoslav,
Hi Phill Hodgkinson,
Thank you for getting back to me.
This attribute can be used to decorate user controls also. It was not clear to me whether you have used a compiled control or a user control from the first message. I have used SiteMapDataSource control and RadSiteMap directly from the Sitefinity toolbox for pages. Can you please show the markup of the script manager, do you have any script references, etc. I am using bellow code:
.master file:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Parent.master.cs" Inherits="SitefinityWebApp.Parent" %>
<!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
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"ScriptManager1"
></
telerik:RadScriptManager
>
<
div
>
<
asp:ContentPlaceHolder
ID
=
"ContentPlaceHolder1"
runat
=
"server"
>
</
asp:ContentPlaceHolder
>
</
div
>
</
form
>
</
body
>
</
html
>
<
telerik:RadSiteMap
runat
=
"server"
DataSourceID
=
"SiteMapDataSource"
ID
=
"SiteMap"
></
telerik:RadSiteMap
>
<
asp:SiteMapDataSource
runat
=
"server"
id
=
"SiteMapDataSource"
/>
[RequireScriptManager]
public
partial
class
MySiteMap: System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
((SiteMapBase)
this
.SiteMapDataSource.Provider).IsNodeAccessible +=
new
EventHandler<IsAccessibleArgs>(SitePanelBar_IsNodeAccessible);
void
SitePanelBar_IsNodeAccessible(
object
sender, IsAccessibleArgs e)
if
(
this
.SiteMapDataSource.StartingNodeUrl == e.Node.Url.Replace(
"~/"
,
""
))
e.IsAccessible =
true
;
return
;
var pageNode = e.Node
as
PageSiteNode;
if
(pageNode !=
null
)
if
(!pageNode.ShowInNavigation)
e.IsAccessible =
false
;
return
;
if
(!pageNode.IsGroupPage && pageNode.ApprovalWorkflowStatus !=
"Published"
)
e.IsAccessible =
false
;
return
;
else
throw
new
NotSupportedException(
"The supported types are 'TaxonSiteNode' or 'PageSiteNode'."
);
e.IsAccessible =
true
;
Hi there,
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Default.Master.cs" Inherits="SitefinityWebApp.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
class
=
"content"
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
></
asp:ScriptManager
>
<
div
id
=
"pageWrapper"
>
<
div
id
=
"topnavWrapper"
>
<
div
id
=
"mainLogo"
>
<
asp:Image
ID
=
"imgLogo"
runat
=
"server"
ImageUrl
=
"~/images/logo-1.gif"
AlternateText
=
""
Width
=
"232"
Height
=
"65"
style
=
"display:block;"
/>
</
div
>
<
div
id
=
"mainMenuLeft"
><
asp:Image
ID
=
"imgMenuSpace"
runat
=
"server"
ImageUrl
=
"~/images/left.gif"
AlternateText
=
""
Width
=
"8"
Height
=
"65"
style
=
"display:block;"
/></
div
>
<
div
id
=
"mainMenu"
><
asp:ContentPlaceHolder
ID
=
"ContentMenuMain"
runat
=
"server"
></
asp:ContentPlaceHolder
></
div
>
<
div
id
=
"mainMenuRight"
><
asp:ContentPlaceHolder
ID
=
"ContentMenuLogin"
runat
=
"server"
></
asp:ContentPlaceHolder
></
div
>
</
div
>
<
div
id
=
"sliderWrapper"
>
<
div
class
=
"sliderLeft"
><
asp:Image
id
=
"img_left"
runat
=
"server"
ImageUrl
=
"~/images/slider-left.gif"
height
=
"85"
width
=
"32"
AlternateText
=
""
/></
div
>
<
div
class
=
"sliderContent sliderTitle"
>
<
h1
id
=
"pageTitle"
><
asp:ContentPlaceHolder
ID
=
"ContentPageTitle"
runat
=
"server"
></
asp:ContentPlaceHolder
></
h1
>
</
div
>
<
div
class
=
"sliderRight"
><
asp:Image
id
=
"img_right"
runat
=
"server"
ImageUrl
=
"~/images/slider-right.gif"
height
=
"85"
width
=
"32"
AlternateText
=
""
/></
div
>
</
div
>
<
div
id
=
"contentWrapper"
>
<
div
id
=
"contentLeft"
>
<
div
class
=
"muGroup"
>
<
div
class
=
"muTop"
>
<
div
class
=
"muTopLeft"
></
div
>
<
div
class
=
"muTopCenter"
></
div
>
<
div
class
=
"muTopRight"
></
div
>
</
div
>
<
div
class
=
"muContent"
>
<
div
class
=
"muMenu"
><
asp:ContentPlaceHolder
ID
=
"ContentSideMenu"
runat
=
"server"
></
asp:ContentPlaceHolder
></
div
>
</
div
>
<
div
class
=
"muBot"
>
<
div
class
=
"muBotLeft"
></
div
>
<
div
class
=
"muBotCenter"
></
div
>
<
div
class
=
"muBotRight"
></
div
>
</
div
>
</
div
>
</
div
>
<
div
id
=
"contentMain"
>
<
h3
><
asp:ContentPlaceHolder
ID
=
"ContentTitle"
runat
=
"server"
></
asp:ContentPlaceHolder
></
h3
>
<
asp:ContentPlaceHolder
ID
=
"ContentMain"
runat
=
"server"
></
asp:ContentPlaceHolder
>
</
div
>
</
div
>
<
div
id
=
"footerPush"
></
div
>
</
div
>
<
div
id
=
"footerWrapper"
>
<
div
id
=
"footerText"
><
asp:ContentPlaceHolder
ID
=
"ContentFooterText"
runat
=
"server"
></
asp:ContentPlaceHolder
></
div
>
<
div
id
=
"footerFollow"
>
<
asp:Image
ID
=
"imgFollow"
runat
=
"server"
ImageUrl
=
"~/images/txt-follow-us.gif"
AlternateText
=
""
Width
=
"53"
Height
=
"18"
style
=
"margin-bottom:14px;"
/>
<
a
href
=
"#"
><
asp:Image
ID
=
"imgFlwRss"
runat
=
"server"
ImageUrl
=
"~/images/button-follow-rss.gif"
AlternateText
=
""
Width
=
"38"
Height
=
"38"
/></
a
>
<
a
href
=
"http://www.facebook.com/"
target
=
"_blank"
><
asp:Image
ID
=
"imgFlwFB"
runat
=
"server"
ImageUrl
=
"~/images/button-follow-facebook.gif"
AlternateText
=
""
Width
=
"38"
Height
=
"38"
/></
a
>
<
a
href
=
"http://twitter.com"
target
=
"_blank"
><
asp:Image
ID
=
"imgFlwTW"
runat
=
"server"
ImageUrl
=
"~/images/button-follow-twitter.gif"
AlternateText
=
""
Width
=
"38"
Height
=
"38"
/></
a
>
</
div
>
<
div
style
=
"width:970px;height:20px;clear:both;"
>
<!--clear-->
</
div
>
<
div
id
=
"footerSiteMap"
>
<
asp:ContentPlaceHolder
ID
=
"ContentFooterSitemap"
runat
=
"server"
></
asp:ContentPlaceHolder
>
</
div
>
</
div
>
</
form
>
</
body
>
</
html
>
protected override void OnPreRender(EventArgs e)
// Register Client Scripts
if (!this.IsDesignMode())
this.Page.ClientScript.RegisterClientScriptInclude("jquery", "/custom/scripts/jquery.js");
this.Page.ClientScript.RegisterClientScriptInclude("cufon", "/custom/scripts/cufon.js");
this.Page.ClientScript.RegisterClientScriptInclude("cufon.font", "/custom/scripts/default.font.js");
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "initcufon", "Cufon.replace('#pageTitle');", true);
base.OnPreRender(e);
protected void Page_Load(object sender, EventArgs e)
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FooterSitemap.ascx.cs" Inherits="SitefinityWebApp.Custom.Navigation.FooterSitemap" %>
<
asp:SiteMapDataSource
ID
=
"SiteMapDataSource1"
runat
=
"server"
ShowStartingNode
=
"false"
/>
<
telerik:RadSiteMap
runat
=
"server"
ID
=
"SiteMap1"
DataSourceID
=
"SiteMapDataSource1"
MaxDataBindDepth
=
"2"
ShowNodeLines
=
"false"
OnNodeDataBound
=
"SiteMap_OnNodeDataBound"
Width
=
"900"
EnableEmbeddedSkins
=
"false"
>
<
LevelSettings
>
<
telerik:SiteMapLevelSetting
Level
=
"0"
ListLayout-RepeatDirection
=
"Horizontal"
ListLayout-RepeatColumns
=
"6"
ListLayout-AlignRows
=
"true"
MaximumNodes
=
"6"
>
</
telerik:SiteMapLevelSetting
>
<
telerik:SiteMapLevelSetting
Level
=
"1"
ListLayout-RepeatDirection
=
"Vertical"
Width
=
"100"
></
telerik:SiteMapLevelSetting
>
</
LevelSettings
>
</
telerik:RadSiteMap
>
protected void Page_Load(object sender, EventArgs e)
protected void SiteMap_OnNodeDataBound(object sender, RadSiteMapNodeEventArgs e)
if (e.Node.Text == "Home")
e.Node.Remove();
Hi Phill Hodgkinson,
I think that the problem is caused by the client scripts registered in the OnInit event handler. I think that is because the last two. I am not including them as I do not have those particular script files. In this case the template is not failing with the above mentioned steps to reproduce.
All the best,
Radoslav Georgiev
the Telerik team
Hi Radoslav,
Hi Radoslav,
[RequireScriptManager]
public partial class FooterSitemap : System.Web.UI.UserControl
[RequireScriptManager]
public partial class CustomMenu : System.Web.UI.UserControl
Hello Phill,
We made some modifications in the code that will be included in the next internal release later this week. Please upgrade your project once the build is out and let us know whether the problem still occurs.
Best wishes,
Ivan Dimitrov
the Telerik team