views:

1042

answers:

2

Hello,

I’m relatively new to ASP.NET and SQL, so what I’m asking maybe a simple question for some, but not for me. What I have is a Grid View that I’m trying to populate softball hitting statistics with. In it I’ve stacked statistics yearly statistics on top of career totals at the very bottom of it. I’ve accomplished this by doing a semi-simple UNION statement with both sets of data (by year and career totals).

What I’m ultimately looking for is there to be a dividing line between the annual totals and career totals. For those of you who are familiar with baseball cards… that is the look I’m going for. Something like this:

SEASON AB R H 2B 3B HR RBI BB K E SAC SLG AVG 2009 63 16 29 3 4 2 19 0 0 0 4 .730 .460


Career Totals 63 16 29 3 4 2 19 0 0 0 4 .730 .460

It seems that when I try to add a single line border to the bottom row (where the career totals are)

RowCount1 = GridView1.Rows.Count - 1 GridView1.Columns.Item(RowCount1).ItemStyle.BorderStyle = BorderStyle.Solid GridView1.Rows.Item(RowCount1).BorderStyle = BorderStyle.Solid

I get a box around the career totals (last record) as opposed to a single line between the two sets of data. I’ve looked online as to how to accomplish this, but have come up empty handed. Perhaps this is such an easy question that most people don’t care to post this, but for me it’s been a mystery.

Any help you can give would be completely appreciated!

A: 

Step 1 is to define a CSS Class, like:

<style type="text/css">
   .sectionBorder
   {
      border-bottom: solid 1px black;         
   }
</style>

Step 2 is to have your logic in RowDataBound or RowCreated like:

   if(e.Row.RowIndex == 2)  // whatever your criteria is.
        e.Row.CssClass = "sectionBorder";
JBrooks
A: 

it works fine as well and u don't need code behind

 <RowStyle CssClass="SearchResultGridRowStyle" />

 .SearchResultGridRowStyle {   
    background-position:bottom;    
    background-image:url(../images/managed_hosting_middle_line.jpg);
    background-repeat:no-repeat; 
}
Dmitry Boyko