You can set the date format by using the below code snippet in ItemDataBound event in telerik radgrid control
Here is a sample c# code for MM/dd/yyyy format
protected void rgDisplay_ItemDataBound(object sender, GridItemEventArgs e)
{
string strDateFormat = "MM/dd/yyyy";
if (e.Item.ItemType == GridItemType.Item ||
e.Item.ItemType == GridItemType.AlternatingItem)
{
GridDataItem gdItem = (GridDataItem)e.Item;
DateTime result;
string dateVal = DataBinder.Eval(gdItem.DataItem, "BindDateColName").ToString();
if (DateTime.TryParse(dateVal, out result))
{
gdItem["uniqueNameDateCol"].Text = result.ToString(strDateFormat);
}
}
}
No comments:
Post a Comment