GridView:隐藏某些单元格周围的边框 [英] GridView: hide border around some cell

查看:85
本文介绍了GridView:隐藏某些单元格周围的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我正在试图隐藏GridView第二列的边框:



Guys, I''m trying to hide border for the 2nd column of GridView:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    e.Row.Cells[1].BorderWidth = 0;
}





但是边框仍然出现:(





有什么问题?





谢谢!



But the border still appears :(


What''s the problem?


Thank you!

推荐答案

看看下面的代码。代码写在gridview的rowcreated事件中,并在其他控件之前添加页面文本。

Have a look at the code below. The code is written in the rowcreated event of the gridview and adds a page text before the other controls.
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
  {
      if (e.Row.RowType == DataControlRowType.Pager)
      {
          Literal ltr = new Literal();
          ltr.Text="Page";
         e.Row.Controls.AddAt(0, ltr);
      }
  }





你可以使用gridview的行样式属性设置边框颜色等。



You can set the border colour etc using the row style property of gridview.


这篇关于GridView:隐藏某些单元格周围的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆