in my rad grid i have a boundColumn(sy开发者_如何学JAVAstem.string) that i want to change it's null value to another customize text...
how can i check and change the Text Of the DataBound column of My telerik RadGrid?
thanks for your future answer
this was my answer :
protected void grd_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
//if (string.IsNullOrEmpty(dataItem["Test"].Text))
if(dataItem["Test"].Text == " ")
{
dataItem["Test"].Text = "Empty";
dataItem["Test"].ForeColor = ColorTranslator.FromHtml("#006E6E");
}
}
}
You can simply use the GridBoundColumn.EmptyDataText
property.
If you are using gridview in the bound column there is a property called "NullDisplayText". You can make use of this for displaying different text in place of Null.
精彩评论