Solved

Grid view conditional formatting

Posted on 2013-12-23
3
246 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
ID: 39737932
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
ID: 39744815
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
ID: 39759367
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

815 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

8 Experts available now in Live!

Get 1:1 Help Now