Solved

asp.net gridview column eval add 0s in front

Posted on 2014-09-24
4
311 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

831 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