Hi All,
After Added Chart ID to AjaxUpdatedControl I got an error:
Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Source Error:
I already use to update a data grid with the same RadAjaxManager and everything works well with the grid!
Here the Ajax setting:
Here the chart declaration:
Here the event execute grid:
Here the successfully updated grid:
And here the C# code for updating the Chart:
After Added Chart ID to AjaxUpdatedControl I got an error:
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
I already use to update a data grid with the same RadAjaxManager and everything works well with the grid!
Here the Ajax setting:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"GrabberMonitorGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"StatisticsGrid"
></
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadChart2"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
Here the chart declaration:
<
telerik:RadChart
runat
=
"server"
Width
=
"945"
ID
=
"RadChart2"
Skin
=
"LightBrown"
Visible
=
"false"
>
<
Appearance
>
<
FillStyle
MainColor
=
"240, 237, 225"
></
FillStyle
>
<
Border
Color
=
"209, 197, 175"
></
Border
>
</
Appearance
>
<
Series
>
<
telerik:ChartSeries
Name
=
"Resieved Query"
Type
=
"SplineArea"
>
<
Appearance
>
<
FillStyle
FillType
=
"ComplexGradient"
MainColor
=
"243, 206, 119"
>
<
FillSettings
>
<
ComplexGradient
>
<
telerik:GradientElement
Color
=
"243, 206, 119"
/>
<
telerik:GradientElement
Color
=
"236, 190, 82"
Position
=
"0.5"
/>
<
telerik:GradientElement
Color
=
"210, 157, 44"
Position
=
"1"
/>
</
ComplexGradient
>
</
FillSettings
>
</
FillStyle
>
<
TextAppearance
TextProperties-Color
=
"112, 93, 56"
>
</
TextAppearance
>
<
Border
Color
=
"223, 170, 40"
/>
</
Appearance
>
<
Items
>
<
telerik:ChartSeriesItem
YValue
=
"1.2"
XValue
=
"0"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"3.2"
XValue
=
"1"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"2.2"
XValue
=
"2"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"5.2"
XValue
=
"3"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"4.2"
XValue
=
"4"
>
</
telerik:ChartSeriesItem
>
</
Items
>
</
telerik:ChartSeries
>
<
telerik:ChartSeries
Name
=
"Recaived Result"
Type
=
"SplineArea"
>
<
Appearance
>
<
FillStyle
FillType
=
"ComplexGradient"
MainColor
=
"154, 220, 230"
>
<
FillSettings
>
<
ComplexGradient
>
<
telerik:GradientElement
Color
=
"154, 220, 230"
/>
<
telerik:GradientElement
Color
=
"121, 207, 220"
Position
=
"0.5"
/>
<
telerik:GradientElement
Color
=
"89, 185, 204"
Position
=
"1"
/>
</
ComplexGradient
>
</
FillSettings
>
</
FillStyle
>
<
TextAppearance
TextProperties-Color
=
"112, 93, 56"
>
</
TextAppearance
>
<
Border
Color
=
"117, 177, 192"
/>
</
Appearance
>
<
Items
>
<
telerik:ChartSeriesItem
YValue
=
"1.1"
XValue
=
"0"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"3.1"
XValue
=
"1"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"2.1"
XValue
=
"2"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"5.1"
XValue
=
"3"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"4.1"
XValue
=
"4"
>
</
telerik:ChartSeriesItem
>
</
Items
>
</
telerik:ChartSeries
>
<
telerik:ChartSeries
Name
=
"Send Order"
Type
=
"SplineArea"
>
<
Appearance
>
<
FillStyle
FillType
=
"ComplexGradient"
MainColor
=
"161, 218, 123"
>
<
FillSettings
>
<
ComplexGradient
>
<
telerik:GradientElement
Color
=
"161, 218, 123"
/>
<
telerik:GradientElement
Color
=
"130, 202, 82"
Position
=
"0.5"
/>
<
telerik:GradientElement
Color
=
"104, 179, 48"
Position
=
"1"
/>
</
ComplexGradient
>
</
FillSettings
>
</
FillStyle
>
<
TextAppearance
TextProperties-Color
=
"112, 93, 56"
>
</
TextAppearance
>
<
Border
Color
=
"81, 162, 37"
/>
</
Appearance
>
<
Items
>
<
telerik:ChartSeriesItem
YValue
=
"1"
XValue
=
"0"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"3"
XValue
=
"1"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"2"
XValue
=
"2"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"5"
XValue
=
"3"
>
</
telerik:ChartSeriesItem
>
<
telerik:ChartSeriesItem
YValue
=
"4"
XValue
=
"4"
>
</
telerik:ChartSeriesItem
>
</
Items
>
</
telerik:ChartSeries
>
</
Series
>
<
Legend
>
<
Appearance
Corners
=
"Round, Round, Round, Round, 6"
>
<
ItemTextAppearance
TextProperties-Color
=
"113, 94, 57"
></
ItemTextAppearance
>
<
Border
Color
=
"225, 217, 201"
></
Border
>
</
Appearance
>
</
Legend
>
<
PlotArea
>
<
XAxis
LayoutMode
=
"Normal"
AutoScale
=
"False"
MaxValue
=
"4"
Step
=
"1"
>
<
Appearance
Color
=
"226, 218, 202"
MajorTick-Color
=
"216, 207, 190"
>
<
MajorGridLines
Color
=
"226, 218, 202"
></
MajorGridLines
>
<
TextAppearance
TextProperties-Color
=
"112, 93, 56"
></
TextAppearance
>
</
Appearance
>
<
AxisLabel
>
<
TextBlock
>
<
Appearance
TextProperties-Color
=
"112, 93, 56"
></
Appearance
>
</
TextBlock
>
</
AxisLabel
>
<
Items
>
<
telerik:ChartAxisItem
Value
=
"1"
></
telerik:ChartAxisItem
>
<
telerik:ChartAxisItem
Value
=
"2"
></
telerik:ChartAxisItem
>
<
telerik:ChartAxisItem
Value
=
"3"
></
telerik:ChartAxisItem
>
<
telerik:ChartAxisItem
Value
=
"4"
></
telerik:ChartAxisItem
>
</
Items
>
</
XAxis
>
<
YAxis
>
<
Appearance
Color
=
"226, 218, 202"
MinorTick-Color
=
"226, 218, 202"
MajorTick-Color
=
"226, 218, 202"
>
<
MajorGridLines
Color
=
"231, 225, 212"
></
MajorGridLines
>
<
MinorGridLines
Color
=
"231, 225, 212"
></
MinorGridLines
>
<
TextAppearance
TextProperties-Color
=
"112, 93, 56"
></
TextAppearance
>
</
Appearance
>
<
AxisLabel
>
<
TextBlock
>
<
Appearance
TextProperties-Color
=
"112, 93, 56"
></
Appearance
>
</
TextBlock
>
</
AxisLabel
>
</
YAxis
>
<
Appearance
Dimensions-Margins
=
"18%, 23%, 12%, 10%"
>
<
FillStyle
MainColor
=
"254, 255, 228"
SecondColor
=
"Transparent"
></
FillStyle
>
<
Border
Color
=
"226, 218, 202"
></
Border
>
</
Appearance
>
</
PlotArea
>
<
ChartTitle
>
<
Appearance
>
<
FillStyle
MainColor
=
""
></
FillStyle
>
</
Appearance
>
<
TextBlock
Text
=
"Intelligent Labels - On"
>
<
Appearance
TextProperties-Color
=
"127, 85, 51"
></
Appearance
>
</
TextBlock
>
</
ChartTitle
>
</
telerik:RadChart
>
Here the event execute grid:
<
telerik:RadGrid
ID
=
"GrabberMonitorGrid"
runat
=
"server"
OnDetailTableDataBind
=
"InstrumentGrid_DatdataBind"
AutoGenerateColumns
=
"False"
AllowMultiRowSelection
=
"false"
AllowSorting
=
"True"
OnItemCommand
=
"RadGrid1_ItemCommand"
ClientSettings-EnablePostBackOnRowClick
=
"true"
CellSpacing
=
"1"
Skin
=
"Office2010Silver"
>
Here the successfully updated grid:
<
telerik:RadGrid
ID
=
"StatisticsGrid"
runat
=
"server"
AllowSorting
=
"True"
EnableLinqExpressions
=
"False"
MasterTableView-ShowHeadersWhenNoRecords
=
"true"
OnDetailTableDataBind
=
"StatisticsGrid_DatdataBind"
Skin
=
"Office2010Silver"
CellSpacing
=
"0"
GridLines
=
"None"
>
<
ClientSettings
AllowKeyboardNavigation
=
"false"
Resizing-AllowColumnResize
=
"True"
>
<
Scrolling
AllowScroll
=
"true"
UseStaticHeaders
=
"true"
ScrollHeight
=
"80%"
/>
</
ClientSettings
>
And here the C# code for updating the Chart:
#region Create chart series collection
RadChart2.Chart.Series.Clear();
for (int i = 0; i <
interpolatedCounters.Length
; i++)
{
InstrumentCountersUnit
currentUnit
=
interpolatedCounters
[i];
foreach (string receivedCounterName in currentUnit.Received.Keys)
{
Telerik.Charting.ChartSeries
singleSeries
=
new
ChartSeries(receivedCounterName, ChartSeriesType.SplineArea);
singleSeries.Name
=
"Recieved "
+ receivedCounterName;
SortedList<DateTime, int> counterValues = currentUnit.Received[receivedCounterName];
for (int j = 0; j <
counterValues.Count
; j++)
{
DateTime
currentValueDate
=
counterValues
.Keys[j];
int
currentValueCounter
=
counterValues
[currentValueDate];
ChartSeriesItem
seriesItem
=
new
ChartSeriesItem(currentValueCounter, currentValueDate.Minute);
singleSeries.AddItem(seriesItem);
}
RadChart2.Chart.Series.Add(singleSeries);
}
foreach (string sentCounterName in currentUnit.Sent.Keys)
{
Telerik.Charting.ChartSeries
singleSeries
=
new
ChartSeries(sentCounterName, ChartSeriesType.SplineArea);
singleSeries.Name
=
"Sent "
+ sentCounterName;
SortedList<DateTime, int> counterValues = currentUnit.Sent[sentCounterName];
for (int j = 0; j < counterValues.Count; j++)
{
DateTime currentValueDate = counterValues.Keys[j];
int currentValueCounter = counterValues[currentValueDate];
ChartSeriesItem seriesItem = new ChartSeriesItem(currentValueCounter, currentValueDate.Minute);
singleSeries.AddItem(seriesItem);
}
RadChart2.Chart.Series.Add(singleSeries);
}
RadChart2.ChartTitle.TextBlock.Text = Name;
RadChart2.Visible = true;
}
#endregion