GridView单元格border设置为none

1.后台           

            GridView1.DataSource = dt;

            GridView1.DataBind();

 

            if (dt != null && dt.Rows.Count > 0)

            {

 

                #region 设置gridview1标题行的style

                GridView1.Attributes.Add("style", "border:none");

                GridViewRow gvr = GridView1.HeaderRow;

                for (int i = 0; i < gvr.Cells.Count; i++)

                {

                    gvr.Cells[i].Attributes.Add("style","border:none");

                }

                #endregion

           }//if

               for (int i = 0; i < GridView1.Rows.Count; i++)

                {

                    GridView1.Rows[i].Cells[0].Attributes.Add("align", "center");

                    GridView1.Rows[i].Cells[0].Attributes.Add("style", "border:none");

                    .................

                }

2.JS动态新加的行

 //添加新行    

       gridview1.setAttribute("style","border:none");

        var newRow=gridview1.insertRow();

        newRow.setAttribute("style","border:none");

        var newCell1=newRow.insertCell();

        var rowsCount=gridview1.rows.length;

        newCell1.innerHTML=rowsCount-1;//第一列;加完新行并除去表头

        newCell1.align="middle";

        newCell1.setAttribute("style","border:none");

        ........................

3.页面中的GridView1(GridLines="None"必要,否则在FireFox中仍然显示网格线)

 <asp:GridView ID="GridView1" runat="server" CssClass="css1" AlternatingRowStyle-BackColor="#F5F5F5"

                       GridLines="None">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值