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

  • SEARCH
  • Home
  • 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 9161999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:06:29+00:00 2026-06-17T14:06:29+00:00

I have a asp gridview which displays the account transactions a user have made.

  • 0

I have a asp gridview which displays the account transactions a user have made. As in transactions, there will be debit and credit of money.

Right now, my gridview displays either

Debit    Credit

$0          $100

$100      $0

and vice versa.

My question is, is there anyway to convert the 0 to a ‘-‘ so that it displays

Debit    Credit

--          $100

$100      -

instead??

My gridview is binded using SQLDataSource control. and the amount is a decimal type.

Or anybody can suggest what is the correct search term for this kind of scenario?

  • 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-06-17T14:06:30+00:00Added an answer on June 17, 2026 at 2:06 pm

    Gridview row databound event can be used to attain this. Please refer the link GridView.RowDataBound Event for more details.

    You can code like

     protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[0].Text == "$0")
                    e.Row.Cells[0].Text = "-";
                if (e.Row.Cells[1].Text == "$0")
                    e.Row.Cells[1].Text = "-";
            }
    
        }
    

    Or you can use a for loop inside RowDataBound event if there are more columns to be formatted. Like

     for (int i = 0; i < e.Row.Cells.Count; i++)
     {
          if (e.Row.Cells[i].Text == "$0")
             e.Row.Cells[i].Text = "-";
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET GridView which displays a list of neighborhoods. I wish a
So I have an ASP.NET page with two controls: a GridView which displays rows
I have a asp:GridView which contains a asp:TextBox within a TemplateField. I would like
I have an ASP.NET(2.0 using C#) web app, in which I have a gridview.
I have a AspxGridView which is linked to a DataSource. Below the GridView there
I currently have an asp:GridView that displays a few BoundFields and then one asp:TemplateField
I have a GridView Template field containing an ASP:Label field which has a unique
I have a few aspx pages which displays GridView controls. In each control I
I have an ASP.NET 4.0 home page which displays about 20 product listings. Each
I have a gridview which displays rows and columns all linked to an sql

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.