0

I have a label in the grid whose value is populated from a dropdown in a popup window(The dropdown has time values in hours - 00 to 23). I have bound the label in the grid like so.

<asp:Label ID="lblFromTime" runat="server" Text='<%# Eval("FromTime", "{0:hh/mm}")%>'></asp:Label>

The problem is when I select 13 from the dropdown(anything greater than 12 for that matter), it is populating as 01-00 rather than 13-00.

How do I display the value as 13-00?

EDIT:

When I change the label like

<asp:Label ID="lblFromTime" runat="server" Text='<%# Eval("FromTime", "{0:HH/MM}")%>'></asp:Label>

and select 13 from my dropdown, it displays the text as 13-04.

1
  • MM is for month and mm is for minutes. Try Jack's answer below. That should do it! Commented Apr 24, 2013 at 12:23

1 Answer 1

1

You need to change the format to:

"{0:HH/mm}"

So for example:

<asp:Label ID="lblFromTime" runat="server" Text='<%# Eval("FromTime", "{0:HH/mm}")%>'></asp:Label>

Capital HH is the key.

This is a good TimeFormatting reference

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.