Hello,
I'm working with a page that has a RadGrid and a RadChart that I want to tie to the same dataview so when I apply a filter to the dataview it is reflected on both the grid and the chart.
I'm having no trouble binding the view to the grid and using the Property Builder to format it. But when I try to basically duplicate the process with the chart I'm getting an error creating the series.
The page load event loads the dataview like this (ignore the fact the the RadGrid references are missing, this is just a copy of the code for testing)...
The RadChart2.Series[0].DataYColumn = "Systolic" line is thowing the error: "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index."
Is what I'm attempting to accomplish possible? (eg - 1 data view used by both objects?)
Any ideas?
Thanks in advance,
Rick
I'm working with a page that has a RadGrid and a RadChart that I want to tie to the same dataview so when I apply a filter to the dataview it is reflected on both the grid and the chart.
I'm having no trouble binding the view to the grid and using the Property Builder to format it. But when I try to basically duplicate the process with the chart I'm getting an error creating the series.
The page load event loads the dataview like this (ignore the fact the the RadGrid references are missing, this is just a copy of the code for testing)...
private void LoadDataView() |
{ |
SqlConnection myConn = new SqlConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]); |
SqlDataAdapter da = new SqlDataAdapter(); |
DataSet ds = new DataSet(); |
try |
{ |
myConn.Open(); |
da.SelectCommand = new SqlCommand("select *, DateDiff(d,TimeStamp,GetDate()) as DaysOld, DateDiff(m,TimeStamp,GetDate()) as MonthsOld,RANK() OVER (order by TIMESTAMP) as RowNumber from ReadHistory where CardID = 'ABC00002' order by TimeStamp", myConn); |
da.Fill(ds, "ReadData"); |
DataView dv = ds.Tables["ReadData"].DefaultView; |
Session["ReadData"] = dv; |
RadChart2.DataSource = dv; |
RadChart2.Series[0].DataYColumn = "Systolic"; |
RadChart2.DataBind(); |
} |
catch (Exception ex) |
{ |
MessageBox.Show("Error Loading Data: " + ex.Message.ToString()); |
} |
} |
The RadChart2.Series[0].DataYColumn = "Systolic" line is thowing the error: "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index."
Is what I'm attempting to accomplish possible? (eg - 1 data view used by both objects?)
Any ideas?
Thanks in advance,
Rick