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 964195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:47:19+00:00 2026-05-16T01:47:19+00:00

In my grid I have data in two columns same for couple of rows.

  • 0

In my grid I have data in two columns same for couple of rows. Then again couple of other rows will same with different data.I want make them into alternative sections with colors

In below example(image).

Rows no 1 to 4 has 'High', 'High'. I want make them gray bgcolor  for those rows.
Rows no 5 to 8 has 'High','Low'. I want make them white bgcolor for those rows
Rows no 9 to 12 has 'High','Medium'. I want make them again gray bg color for 
those rows.

alt text

How can we do that?

  • 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-16T01:47:20+00:00Added an answer on May 16, 2026 at 1:47 am

    OK — just modify Leniel Macaferi’s answer: (I’m mixing a little w/ vb because I’m not a c# guy — sorry — the point should still be clear though I hope)

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
           // Display the company name in italics.
           Session("New_Pair_1") = e.Row.Cells[1].Text
           Session("New_Pair_2") = e.Row.Cells[2].Text
    
           If Session("New_Pair_1") <> Session("OLD_Pair_1") OR _
              Session("New_Pair_2") <> Session("OLD_Pair_2") Then
                 //no pair match with last record's pair
                 //step 1, change the backcolor
                   If e.Row.BackColor = Color.FromName("Gray") Then
                      e.Row.BackColor = Color.FromName("White")
                   Else
                      e.RowlBackColor = Color.FromName("Gray")
                   End If
                 //Step 2, reset the "OLD" session vars
                   Session("OLD_Pair_1") = Session("New_Pair_1")
                   Session("OLD_Pair_2") = Session("New_Pair_2")
           End If
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two columns that are min_price and min_price . Most of the time,
I have a View Feedback page with two drop down lists to filter the
I have a table in which one column (type ntext) has data that includes
I have a large amount of data to import in to MATLAB, representing location
I am still learning to use MVVM and Prism and have some general questions:
Im using LinqDataSource like that: <asp:LinqDataSource ID=LinqDataSource3 runat=server OnSelecting=LinqDataSource3_OnSelecting> </asp:LinqDataSource> And I have ASPxGridView
I have a jgrid and on selectiing and submitting the row I have to
I have a very large comma-seperated text-file. I need to display this in a
this is my Question extension to this Question .. Here I am able to
Our jqGrid is working well - if we return > 1 row everything works.

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.