Hi Kurt,
For achieving the desired result you will have to set the EnablePostBackOnRowClick property of the grid to true, handle the server-side OnItemCommand event, retrieve the information from the GridDataItem cells and create custom data source object that could be provided to the RadHtmlChart:
And the code-behind:
protected
void
RadGrid1_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
DataTable table =
new
DataTable();
table.Columns.Add(
"ID"
,
typeof
(
int
));
table.Columns.Add(
"3/31/2009"
,
typeof
(
decimal
));
table.Columns.Add(
"6/30/2009"
,
typeof
(
decimal
));
table.Columns.Add(
"9/30/2009"
,
typeof
(
decimal
));
for
(
int
i = 1; i < 5; i++)
{
table.Rows.Add(i, 500 + i, 100 + i, 800 + i);
}
(sender
as
RadGrid).DataSource = table;
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"RowClick"
)
{
GridDataItem item = e.Item
as
GridDataItem;
DataTable table =
new
DataTable();
table.Columns.Add(
"date"
,
typeof
(
string
));
table.Columns.Add(
"spentMoney"
,
typeof
(
string
));
foreach
(GridColumn column
in
RadGrid1.MasterTableView.RenderColumns)
{
if
(column.UniqueName.IndexOf(
"/"
) >= 0)
{
table.Rows.Add(column.UniqueName, item[column.UniqueName].Text);
}
}
RadHtmlChart1.DataSource = table;
RadHtmlChart1.DataBind();
}
}
Hope this helps.
Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items