Hi,
I bind my grid programmatically during the NeedDataSource event which is in turn a SQLDataSource instance:
From here I’m trying to check if the value of a specific cell match a condition during the ItemCreated event:
For some reason the value of item[“ValidationState”].Text is always " " as so is any other cell I’m trying to access via the UniqueName property. And yes, they are explicitly defined in my markup of the columns.
It is maybe becuase I bind the grid during NeedDataSource and not at design time with the DataSourceID property specified? Or perhaps other suggestion or solutions?
Thanks for you help!
I bind my grid programmatically during the NeedDataSource event which is in turn a SQLDataSource instance:
protected
void
grdMyGrid_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
((RadGrid)sender).DataSource = sqlDs;
}
From here I’m trying to check if the value of a specific cell match a condition during the ItemCreated event:
protected
void
grdMyGrid_ItemCreated(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
var item = e.Item
as
GridDataItem;
if
(item[
"ValidationState"
].Text ==
"UNMATCHED"
)
{
item.BackColor = System.Drawing.Color.Red;
item.ForeColor = System.Drawing.Color.White;
}
}
}
For some reason the value of item[“ValidationState”].Text is always " " as so is any other cell I’m trying to access via the UniqueName property. And yes, they are explicitly defined in my markup of the columns.
It is maybe becuase I bind the grid during NeedDataSource and not at design time with the DataSourceID property specified? Or perhaps other suggestion or solutions?
Thanks for you help!