向 Gridview 添加行分隔符
我对 ASP.NET 和 SQL 比较陌生,所以我问的问题对某些人来说可能是一个简单的问题,但对我来说不是。 我拥有的是一个网格视图,我试图用它来填充垒球击球统计数据。 在其中,我将年度统计数据堆叠在其最底部的职业生涯总计之上。 我通过对两组数据(按年份和职业生涯总计)执行半简单的 UNION 语句来完成此任务。
我最终想要的是年度总数和职业生涯总数之间有一条分界线。 对于那些熟悉棒球卡的人来说……这就是我想要的外观。 像这样的东西:
SEASON AB RH 2B 3B HR RBI BB KE SAC SLG AVG 2009 63 16 29 3 4 2 19 0 0 0 4 .730 .460
职业生涯总计 63 16 29 3 4 2 19 0 0 0 4 .730 .460
似乎当我尝试在底行添加单行边框时 (其中职业总数为)
RowCount1 = GridView1.Rows.Count - 1 GridView1.Columns.Item(RowCount1).ItemStyle.BorderStyle = BorderStyle.Solid GridView1.Rows.Item(RowCount1).BorderStyle = BorderStyle.Solid
我在职业生涯总计(最后一条记录)周围得到一个框,而不是两组数据之间的单行。 我在网上寻找如何实现这一点,但空手而归。 也许这是一个很简单的问题,大多数人都不愿意发布这个问题,但对我来说,这是一个谜。
您能提供的任何帮助将不胜感激!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
步骤 1 是定义一个 CSS 类,例如:
步骤 2 是在 RowDataBound 或 RowCreated 中添加逻辑,例如:
Step 1 is to define a CSS Class, like:
Step 2 is to have your logic in RowDataBound or RowCreated like:
它工作得很好,而且你不需要后面的代码
it works fine as well and u don't need code behind