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="width: 420px">
</div>
<div style="overflow: scroll; width: 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; width: 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");
}
}