Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Grid view conditional formatting

Posted on 2013-12-23
3
Medium Priority
?
259 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

916 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