Solved

asp.net gridview column eval add 0s in front

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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