zoukankan      html  css  js  c++  java
  • ScrollGridView 标题不变化 内容变化

    <script type="text/javascript">
    function fixHead() {
    var grid = document.getElementById("<%=GridView1.ClientID%>");
    var grid2 = grid.cloneNode(true)
    for (i = grid2.rows.length - 1; i > 0; i--)
    grid2.deleteRow(i)
    grid.deleteRow(0)
    divHead.appendChild(grid2)
    }
    window.onload = fixHead
    </script>

    <div id="divHead" style=" 420px">
    </div>
    <div style="overflow: scroll; 420px; height: 150px">

    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BulletinID"
    EmptyDataText="没有可显示的数据记录。" OnRowDataBound="GridView1_RowDataBound" CellPadding="4"
    ForeColor="#333333" GridLines="None">

      </asp:GridView>

    style="overflow: scroll; 420px; height: 150px">

     </div>

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow) //如果是数据行
    {
    string content = e.Row.Cells[2].Text;
    //已设置公告内容列的宽度是20
    //给公告内容列添加word-break属性
    e.Row.Cells[2].Style.Add("word-break", "break-all");
    }
    }

  • 相关阅读:
    Bootstrip的相关介绍
    Django的ORM主外键约束实现
    Django基于ORM数据库配置
    Django的安装与配置
    ORM(关系对象映射)框架之面向对象
    pymysql模块的数据操作
    SQL语句实践
    mysql 数据库的基本操作语法
    算法训练 矩阵乘法
    算法训练 字串统计
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2867819.html
Copyright © 2011-2022 走看看