Hey, I have a grid being created dynamically from a manually built pivot table with includes a variable number of columns and a variable number of rows.
I've gotten it to display statically quite easily, but what I would like to be able to do is replace the static numbers with a textbox containing the numeric value for each column for each view. And then be able to iterate through those rows on a click event to save any changed data.
Super simple code right now:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnItemCreated
=
"RadGrid1_ItemCreated"
>
</
telerik:RadGrid
>
Code behind - all the hard work is done in creating a dynamic pivot table (dt):
RadGrid1.DataSource = dt;
RadGrid1.DataBind();
I've got code in the ItemCreated event to try to create a textbox, but this code is not working:
protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
DataRowView drv = (DataRowView)e.Item.DataItem;
TextBox txt = new TextBox();
txt.Text = drv[0].ToString();
e.Item.Cells[0].Controls.Add(txt);
}
}
Thanks!!