首页 新闻 会员 周边 捐助

后台动态锁定列

1
悬赏园豆:15 [已关闭问题] 关闭于 2011-04-19 10:56

一下是Test  的代码,比如想锁定1  2 两列(或动态锁定某几列)该如何实现?

View Code
void Bind_Load(int columns_Count,int row_Count)
{
dt
= new DataTable();
for (int i = 0; i < columns_Count; i++)
{
dt.Columns.Add(
"Column_" + i, typeof(string));
}
for (int j = 0; j < row_Count; j++)
{
dr
= dt.NewRow();
for (int i = 0; i < columns_Count; i++)
{
dr[
"Column_" + i] = j == 0 ? i * 10 : (j+i) * 10;
}
dt.Rows.Add(dr);
}


tb.Width
= (columns_Count * 80).ToString();

foreach (DataRow dr in dt.Rows)
{
HtmlTableRow tr
= new HtmlTableRow();
tr.Height
= "25"; tr.Align = "left"; tr.VAlign = "middle";
foreach (DataColumn dc in dt.Columns)
{
HtmlTableCell td
= new HtmlTableCell();
td.Align
= "center"; td.BgColor = "#f3f8fd"; td.Align = "center";
if (dc.Caption == "Column_0" || dc.Caption == "Column_1")
{
td.Attributes.CssStyle.Add(
"LEFT", "expression(this.offsetParent.scrollLeft)");
td.Attributes.CssStyle.Add(
"POSITION", "relative");
}
td.InnerHtml
= string.Format("<b>{0}</b>",dr[dc].ToString());
tr.Cells.Add(td);
tb.Rows.Add(tr);
}
}
}
like%'远远'%的主页 like%'远远'% | 小虾三级 | 园豆:635
提问于:2011-04-15 13:56
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册