Solved

asp.net gridview column eval add 0s in front

Posted on 2014-09-24
4
307 Views
Last Modified: 2014-09-29
trying to display '00001' in the gridview column from the database
where the value is only 1, 2, 3...etc

eg.
  <asp:TemplateField HeaderText="Invoice No." SortExpression="invoiceno" ItemStyle-Width="180px" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <b><%# Eval("invoiceno")%></b>
                    </ItemTemplate>
                </asp:TemplateField>

Open in new window

0
Comment
Question by:doramail05
  • 3
4 Comments
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 40341230
Have you checked the datasource? It might have the same value.
You need to adjust it in the query if the database has same value stored.
0
 
LVL 1

Author Comment

by:doramail05
ID: 40343358
solved with this :
0
 
LVL 1

Accepted Solution

by:
doramail05 earned 0 total points
ID: 40343359
<asp:TemplateField HeaderText="Invoice No." SortExpression="invoiceno" ItemStyle-Width="180px"
                ItemStyle-HorizontalAlign="Center">
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0:00000}", Convert.ToInt64(Eval("invoiceno")))%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

Open in new window

0
 
LVL 1

Author Closing Comment

by:doramail05
ID: 40349510
solve from other post
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now