0

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!

4

2 回答 2

0

第 1 步是定义一个 CSS 类,例如:

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

第 2 步是让您的逻辑在 RowDataBound 或 RowCreated 中,如:

   if(e.Row.RowIndex == 2)  // whatever your criteria is.
        e.Row.CssClass = "sectionBorder";
于 2009-07-15T04:06:29.447 回答
0

它也可以正常工作,您不需要后面的代码

 <RowStyle CssClass="SearchResultGridRowStyle" />

 .SearchResultGridRowStyle {   
    background-position:bottom;    
    background-image:url(../images/managed_hosting_middle_line.jpg);
    background-repeat:no-repeat; 
}
于 2009-10-26T21:43:35.100 回答