HI all,
I found the solution as follows:
aspx grid code:
<asp:TemplateField HeaderText="" ControlStyle-Width="20px" ItemStyle-BackColor="#FFFFFF" ItemStyle-Font-Names="Verdana">
<ItemTemplate>
<asp:Label ID="lblDateTimeSent" runat="server" Text='<%# FormatDate(Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "DateTimeSent"))) %>' style="text-align:center;"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Code behind code:
public string FormatDate(DateTime input)
{
if (languageId == int.Parse(System.Configuration.ConfigurationManager.AppSettings["DefaultLanguageID"]))
{
return string.Format("{0:MM/dd/yy}", input);
}
else
{
return string.Format("{0:dd/MM/yy}", input);
}
}
This above solution will be helpful to all but this will not work with the bound field. If there are bound fields then we need to use the item template instead.
Thanks