This seems like it should be a straight forward thing to do, but it's eluding me, and I've searched for an answer. Hopefully I'm overlooking something simple.
I'm binding my RadGrid to an entity data source. I'm using GridTemplateColumn columns for many of the columns, as I combine several of the data fields into one column. How do I access the RadGrid datasource's field values (in the code-behind)? This is in non-edit, regular view of the grid.
For example, I'd like to do something like this:
Thanks,
Steve
I'm binding my RadGrid to an entity data source. I'm using GridTemplateColumn columns for many of the columns, as I combine several of the data fields into one column. How do I access the RadGrid datasource's field values (in the code-behind)? This is in non-edit, regular view of the grid.
For example, I'd like to do something like this:
protected void ContactsGrid_ItemDataBound(object sender, GridItemEventArgs e){ if ((!e.Item.IsInEditMode) && (e.Item is GridDataItem)) { GridDataItem dataItem = (GridDataItem)e.Item; // Assuming my entity data source has a field named "dataFieldName", would be nice to access: string dataFieldValue = (string)dataItem("dataFieldName").Value;
// Would then find the GridTemplateColumn in order to fill in the ItemTemplate,
// which already know how to do...
}}Thanks,
Steve