Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6036947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:00:00+00:00 2026-05-23T06:00:00+00:00

im using a gridview to display data taken from a dataset which looks like

  • 0

im using a gridview to display data taken from a dataset which looks like

NAME | GP   | ORD_GP | EXP   | TOTAL GP | TARGET
a      206     48      -239     15         1600
b      0       27       0        27        1520
TOTAL  206     75      -239     42         3120 

im using TemplateField like so but this can just format values.

    <asp:TemplateField HeaderText="%" ItemStyle-BackColor="Yellow" >
        <ItemTemplate>
            <span class='<%# double.Parse(Eval("PERC_OF_TARGET").ToString()) >= 100 ? "PERC_MoreThan" : "PERC_LessThan"  %>'>
            <%# Eval("PERC_OF_TARGET")%> %
        </span>
    </ItemTemplate>
</asp:TemplateField>

however what I want to do is format the last row (TOTAL) so that the background colour is green.

also is there a way that I can evaluate each item and if it equals to 0 Do not display anything and just leave it blank ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T06:00:01+00:00Added an answer on May 23, 2026 at 6:00 am

    for making the last row of grid view green:

    int r = GridView.Rows.Count;
    r--;
    GridView.Rows[r].BackColor = System.Drawing.Color.Green;
    

    and to evaluate the value of each cell and make it blank if its 0:

    for (int i = 0; i < dt.Rows.Count; i++)
    {
        for (int j = 0; j < dataTable.Columns.Count; j++)
        {
            if (Convert.ToInt32(dt.Rows[i][j]) == 0)
            {
                dt.Rows[i][j] = "";
            }
        }
    }
    

    hope thats what you needed!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView using LinqDataSource to populate data from table Tickets . The
i need to display the name of enum in gridview by data table returns
i want to display some information in a listview using the GridView. i have
I'm trying get values from a GridView using the following code: foreach (GridViewRow row
I'm using an ObjectDataSource to bind data to a GridView; it works fine except
Greetings! I'm creating a User Control that will display data in a GridView control.
Often I need to combine data from multiple tables and display the result in
I have a gridview which displays data for all employees and their images (stored
We're using a WPF GridView that is dynamically bound to a DataTable (which in
I've a Gridview control using an ODS(ObjectDataSource) to fetch data. For the best performance

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.