How to set only date in the gridview in asp.net C#

Many time we need to bind the only date value in the gridview , but we are always getting the date time in date with time-stamp, so we are want to remove the time-stamp and show the only date in grid view.we can bind the value in to format  first we bind the value in control or we can also done by bound field.


By bind the value :-

<asp:Label ID="lblbrithday" runat="server" Text='<%# Eval("Brithday", "{0:d}") %>'></asp:Label>

By bound filed:-
          <asp:BoundField DataField="Brithday"HeaderText="Brithday" SortExpression="Brithday" DataFormatString="{0:d}"
                                ItemStyle-Width="50px" />


Out :put:-
neerajcodesolutions-date

How to set only date in the gridview in asp.net C# How to set only date in the gridview in asp.net C# Reviewed by NEERAJ SRIVASTAVA on 6:59:00 PM Rating: 5

No comments:

Powered by Blogger.