troubleshooting Question

Add additional text to databound cell in gridview c#

Avatar of Codingitup
Codingitup asked on
5 Comments1 Solution703 ViewsLast Modified:
Hi All,

I've got a datagrid view that has databound cells that return a numeric value. I'm trying to find out how I append to the data retrieved. Ie, if the cell receives 95.6 I would like to append a '%' symbol at the end to produce '95.6%'. I don't want to do this in my sql code as I need to do some other code depending on the number received.

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        <AlternatingRowStyle BackColor="#FFCC00" />
            <asp:BoundField DataField="OrderNo" HeaderText="OrderNo"
                SortExpression="OrderNo" />
            <asp:BoundField DataField="MailingName" HeaderText="MailingName"
                SortExpression="MailingName" />
            <asp:BoundField DataField="Sale Price" HeaderText="Sale Price"
                SortExpression="Sale Price" ReadOnly="True" />
            <asp:BoundField DataField="Cost" HeaderText="Cost" SortExpression="Cost"
                ReadOnly="True" />
            <asp:BoundField DataField="MarginPer" HeaderText="MarginPer" ReadOnly="True"
                SortExpression="MarginPer" />

Many Thanks
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros