Solved

Grid view conditional formatting

Posted on 2013-12-23
3
245 Views
Last Modified: 2014-01-20
Hi,
I have a grid view that has some grouping, is there anyway that where there is commonality between rows that I could highlight the row which has the latest date within it?
Using asp.net
0
Comment
Question by:andyw27
3 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
Probably. Can you provide a bit more info about how you are populating your grid, the data source, whether you are grouping within the grid, or at the datasource, etc?
0
 
LVL 8

Accepted Solution

by:
johny_bravo1 earned 500 total points
Comment Utility
You can use the RowDataBound event for formatting your gridview.

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
  // Check if row is data row, not header, footer etc.
  if (e.Row.RowType == DataControlRowType.DataRow)
  {
//access your boundfield or templatefield values
  }
}
0
 

Author Comment

by:andyw27
Comment Utility
Hi,

I have a grid view which is populated like this:

25102      Attr1      Dec 23 2012 3:48PM
25102      Attr1      Jul 5 2012 11:45AM
10009      Attr2      Jan 6 2014 1:19PM
10009      Attr2      Dec 24 2013 8:10AM
10009      Attr2      Dec 23 2013 3:48PM
11759      Attr3      Jul 5 2012 11:45AM


What I’d like to do is to apply some conditional formatting to it so that it highlights the latest value where column 1 & 2 are the same:  Thus in the case above it would look like this:

25102      Attr1      Dec 23 2012 3:48PM      Highlight Row
25102      Attr1      Jul 5 2012 11:45AM      
10009      Attr2      Jan 6 2014 1:19PM      Highlight Row
10009      Attr2      Dec 24 2013 8:10AM      
10009      Attr2      Dec 23 2013 3:48PM      
11759      Attr3      Jul 5 2012 11:45AM      Highlight Row


Can’t figure out what the logic should be?
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now