Hi Anand,
For Datetimepicker date format. refer
http://stackoverflow.com/questions/10589877/format-datetimepicker-in-datagridview-column
http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/bb5ef524-b2ba-4420-82ac-230d156695aa[
^]
For gridview date column dateformat
Their are two ways you can do that
1 You can write a Function on the code behind page like
Public Function ReturnOnlyDate(TDate As String) As String
Try
If TDate.Length = 19 Then ' 12/30/1899 00:00:13
Return (TDate.Remove(10, 9))
End If
Catch ex As Exception
Return Nothing
End Try
Return Nothing
End Function
and you should convert the date field in the gridview to Template field. and in the source page you change the bound field like this
<asp:templatefield headertext="Date" xmlns:asp="#unknown">
<asp:label id="Label2" runat="server" text="<%# ReturnOnlyDate(Eval("TDate"))%>">
<asp:label id="Label2" runat="server" text="<%# ReturnOnlyDate(Eval("TDate")))%>">
2. You can DIrectly convert the field to Template field and in the source page your can do like this.
<asp:templatefield headertext="Date" xmlns:asp="#unknown">
<asp:label id="Label2" runat="server" text="<%# Bind("TDate", "{0:MM/dd/yyyy}") %>">
<asp:label id="Label2" runat="server" text="<%# Bind("TDate", "{0:MM/dd/yyyy}") %>">
This could help.