Formatting numbers in a repeater control

My output of number in my repeater control displays as for example 1000 and I prefer with a comma as 1,000

here's the code..

                 <td>
                                                <asp:Label ID="lblActMin" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ACTUAL_MINIMUM")%>'></asp:Label>


                                            </td>

Open in new window

zachvaldezAsked:
Who is Participating?
 
Ryan ChongCommented:
sorry as was away for quite some time...

try:

<%# Eval("ACTUAL_MINIMUM", "{0:#,0.00}") %>

Open in new window


or create a custom function like:

<%# Format(Eval("ACTUAL_MINIMUM")) %>

Open in new window


then:

protected string Format(object v)
        {
            return ((decimal)v).ToString("#,0.00");
        }

Open in new window

0
 
Ryan ChongCommented:
you can write and then call the “custom function” to format the output.
0
 
zachvaldezAuthor Commented:
May I request for the code that formats it please?
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
zachvaldezAuthor Commented:
                              <td>
                                   <asp:Label ID="lblActMin" runat="server" Text='<%# DataBinder.Eval (Container.DataItem, "ACTUAL_MINIMUM")%>'></asp:Label>


                                            </td>

Open in new window


I just want to format the text to display as 1,000.00 and not 1000.00
0
 
zachvaldezAuthor Commented:
As I do not get a response, can the admin just delete this question please?
0
 
zachvaldezAuthor Commented:
that wad great! thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.