Solved

asp.net gridview column eval add 0s in front

Posted on 2014-09-24
4
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

688 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