?
Solved

asp.net gridview column eval add 0s in front

Posted on 2014-09-24
4
Medium Priority
?
324 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 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