zoukankan      html  css  js  c++  java
  • GridView自动生成列时,利用DIV控制显示长宽 控件数据行和表头文字不换行

    <div style="600px; height:300px; overflow-x:auto; ">
    <asp:GridView ID="GridView1" runat="server" ClientIDMode="Static" AutoGenerateColumns="True"
    	 CssClass="gvCss" onrowcreated="GridView1_RowCreated">
    	<RowStyle HorizontalAlign="Center" />
    	<HeaderStyle CssClass="gvCss head" />
    </asp:GridView>
    </div>

        protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
            {
                TableCellCollection cells1 = e.Row.Cells;
                for (int i = 0; i < cells1.Count; i++)
                {
                    cells1[i].Wrap = false;
                }
            }
        }

  • 相关阅读:
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    es5
    es5
    es5||es6
    es5
    5 个常用的软件质量指标
    Solr
  • 原文地址:https://www.cnblogs.com/smartsmile/p/6234382.html
Copyright © 2011-2022 走看看