Solved

Grid view conditional formatting

Posted on 2013-12-23
3
247 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

821 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