4 Answers, 1 is accepted
0
Hello Gk,
You could use an if statement like this:
As you are new to RadChart, you could find a lot of useful information in our help topics here or check out our demo examples here, as well.
Kind regards,
Peshito
the Telerik team
You could use an if statement like this:
if (radChart.Series.Count == 0)
{
radChart.Visible = false;
}
Kind regards,
Peshito
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
GK
Top achievements
Rank 1
answered on 04 Aug 2011, 10:43 AM
Hi Peshito,
Thanks for your reply, But I am sorry to say, I have tried this earlier, in page_load, I am getting count=1 even if there are no records in it, I am having a couple of charts in my page, so i want to eliminate the charts if they won't have any records in it.
Below is the aspx code which I am using for chart.
waiting for your early reply,
Many Thanks
Gopi Krishna
Thanks for your reply, But I am sorry to say, I have tried this earlier, in page_load, I am getting count=1 even if there are no records in it, I am having a couple of charts in my page, so i want to eliminate the charts if they won't have any records in it.
Below is the aspx code which I am using for chart.
<
telerik:RadChart
ID
=
"rct_XYZ"
DataSourceID
=
"sds_SummaryCard"
DefaultType
=
"Bar"
Width
=
"500px"
AutoLayout
=
"true"
runat
=
"server"
>
<
ChartTitle
Appearance-FillStyle-MainColor
=
"#220000"
TextBlock-Text
=
"....XYZ"
TextBlock-Appearance-TextProperties-Color
=
"#FFBB22"
/>
<
Appearance
FillStyle-MainColor
=
"#220000"
/>
<
Legend
Visible
=
"false"
/>
<
Series
>
<
telerik:ChartSeries
DataYColumn
=
"Percentage"
DefaultLabelValue
=
"#Y%"
Appearance-TextAppearance-TextProperties-Color
=
"#FFBB22"
>
</
telerik:ChartSeries
>
</
Series
>
<
PlotArea
>
<
YAxis
Appearance-CustomFormat
=
"0.00\%"
Appearance-TextAppearance-TextProperties-Color
=
"#FFBB22"
/>
<
XAxis
AxisLabel-Visible
=
"true"
AxisLabel-TextBlock-Text
=
"XYZ"
DataLabelsColumn
=
"XYZ"
AxisLabel-TextBlock-Appearance-TextProperties-Color
=
"#FFBB22"
Appearance-TextAppearance-TextProperties-Color
=
"#FFBB22"
/>
</
PlotArea
>
</
telerik:RadChart
>
Many Thanks
Gopi Krishna
0
Hello Gk,
The reason why your count is equal to 1 is because your series is defined in the markup. This way you will always have a default series included in the RadChart1.Series.Count.
What you should do is to define the series in code behind and follow the same approach.
Kind regards,
Peshito
the Telerik team
The reason why your count is equal to 1 is because your series is defined in the markup. This way you will always have a default series included in the RadChart1.Series.Count.
What you should do is to define the series in code behind and follow the same approach.
Kind regards,
Peshito
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
GK
Top achievements
Rank 1
answered on 12 Aug 2011, 11:41 AM
Hi Peshito,
Thanks for your reply,
I could made a workaround for this, but I was expecting something like Gridview.rows.count > 0 logic, same for RadCharts.
Rather changing my code. I am checking for data in the SQLDataSoure which i am binding to RadChart, and then making visible false if there exists no data.
Thanks
Gopi Krishna
Thanks for your reply,
I could made a workaround for this, but I was expecting something like Gridview.rows.count > 0 logic, same for RadCharts.
Rather changing my code. I am checking for data in the SQLDataSoure which i am binding to RadChart, and then making visible false if there exists no data.
DataView dv4 = (DataView)sds_SummaryCard.Select(DataSourceSelectArguments.Empty);
if (dv4.Table.Rows.Count == 0)
rct_XYZ.Visible = false;
Thanks
Gopi Krishna