I have a Telerik radgrid textbox that stores date value. On update of the grid for the date I get an issue. Can anyone help me regarding this. I tried DateTime.TryParse ,Convert.Datatime... But nothing worked..
<telerik:GridBoundColumn DataField="DTTM"
HeaderText="Date Registered" SortExpression="DTTM" UniqueName="DTTM">
</telerik:GridBoundColumn>
On update:
updhost.DTTM=ShowDate((RadTextBox)editedItem.FindControl("DtB"));
ShowDate()
private string ShowDate(object datVal)
{
string newStr = "";
DateTime tmpDttm = default(DateTime);
if ((datVal != null))
{
try
{
tmpDttm = (DateTime)datVal;
newStr = tmpDttm.ToString("MM/dd/yyyy h:mm tt") + " ";
}
catch (Exception ex) {
//Do Nothing
}
}
return newStr;
}