Hello,
I am working on developing a Visual Web Part for SharePoint 2010, which creates a custom user control and deploys it to SharePoint. My scenario is almost identical to the scenario at:
http://demos.telerik.com/aspnet-ajax/htmlchart/examples/drilldownchart/defaultcs.aspx
My code is working great as a standalone website, but when I deploy as a custom user control and webpart, I get this error when I try to click on a chart series for a drill down:
Based on my research, this error seems to be related to the way my RadAjaxManager works. My guess is that there must be some conflict with the SharePoint environment and how it controls webparts. If I had to guess, I would say that SharePoint is creating some kind of an ajax update container around the entire web part, and then my RadAjaxManager is creating another one, which is giving me this nested update panel error.
Here is the relevant code:
and in the code behind:
I am working on developing a Visual Web Part for SharePoint 2010, which creates a custom user control and deploys it to SharePoint. My scenario is almost identical to the scenario at:
http://demos.telerik.com/aspnet-ajax/htmlchart/examples/drilldownchart/defaultcs.aspx
My code is working great as a standalone website, but when I deploy as a custom user control and webpart, I get this error when I try to click on a chart series for a drill down:
Based on my research, this error seems to be related to the way my RadAjaxManager works. My guess is that there must be some conflict with the SharePoint environment and how it controls webparts. If I had to guess, I would say that SharePoint is creating some kind of an ajax update container around the entire web part, and then my RadAjaxManager is creating another one, which is giving me this nested update panel error.
Here is the relevant code:
<
telerik:RadButton
runat
=
"server"
Icon-PrimaryIconUrl
=
"/_layouts/images/back.gif"
ID
=
"Refresh"
Text
=
"Restore Original Chart"
OnClick
=
"Refresh_Click"
>
</
telerik:RadButton
>
<
telerik:RadCodeBlock
ID
=
"codeBlock"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function pageLoad(sender, eventArgs) {
if (!eventArgs.get_isPartialLoad()) {
//$find("<%--RadAjaxManager.GetCurrent(this).ClientID --%>").ajaxRequest("InitialPageLoad");
}
}
function OnClientSeriesClicked(sender, args) {
//console.log(args.get_category());
if (args.get_seriesName() != "seriesPlanMemberCount") $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(args.get_category());
}
</
script
>
</
telerik:RadCodeBlock
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadHtmlChart1"
LoadingPanelID
=
"LoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"Refresh"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadHtmlChart1"
LoadingPanelID
=
"LoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadHtmlChart
ID
=
"RadHtmlChart1"
Skin
=
"Sitefinity"
DataSourceID
=
"SqlDataSource1"
runat
=
"server"
Height
=
"600px"
Width
=
"600px"
OnClientSeriesClicked
=
"OnClientSeriesClicked"
>
<
ChartTitle
Text
=
"OCERS Members By Employer"
>
<
Appearance
Align
=
"Center"
BackgroundColor
=
"White"
Position
=
"Top"
>
</
Appearance
>
</
ChartTitle
>
<
PlotArea
>
<
Series
>
<
telerik:ColumnSeries
DataFieldY
=
"MEMBERCOUNT"
Name
=
"seriesMemberCount"
>
</
telerik:ColumnSeries
>
</
Series
>
<
XAxis
DataLabelsField
=
"EMPLOYER_NAME"
>
<
LabelsAppearance
Visible
=
"true"
RotationAngle
=
"90"
>
</
LabelsAppearance
>
<
MinorGridLines
Visible
=
"false"
/>
</
XAxis
>
<
YAxis
>
<
LabelsAppearance
DataFormatString
=
"{0}"
Visible
=
"true"
>
</
LabelsAppearance
>
<
MinorGridLines
Visible
=
"false"
/>
</
YAxis
>
</
PlotArea
>
<
Legend
>
<
Appearance
Visible
=
"false"
>
</
Appearance
>
</
Legend
>
</
telerik:RadHtmlChart
>
and in the code behind:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
if (e.Argument == "InitialPageLoad")
{
Refresh_Click(sender, e);
}
else
{
if (RadHtmlChart1.PlotArea.Series[0].Name == "seriesMemberCount")
{
SqlDataSource2.SelectParameters[0].DefaultValue = e.Argument;
RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "PLAN_NAME";
RadHtmlChart1.PlotArea.Series[0].DataFieldY = "MEMBERCOUNT";
RadHtmlChart1.PlotArea.Series[0].Name = "seriesPlanMemberCount";
RadHtmlChart1.Skin = "Office2010Blue";
RadHtmlChart1.ChartTitle.Text = e.Argument + " Plan Members By Plan Type";
RadHtmlChart1.DataSourceID = "SqlDataSource2";
//Refresh.Visible = true;
}
}
}