How to show on time in the gridview in asp.net C#

Many time we need to bind the only time value in the gridview , but we are always getting the date time in date with time-stamp.


so we are want to remove the date and show the only time in gridview. 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="lblregistration" runat="server" Text='<%# Eval("Registration_Time ", "{0:t}") %>'></asp:Label>

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

Out :put:-







How to show on time in the gridview in asp.net C# How to show on time in the gridview in asp.net C# Reviewed by NEERAJ SRIVASTAVA on 3:39:00 PM Rating: 5

No comments:

Powered by Blogger.