【发布时间】:2013-09-25 13:12:28
【问题描述】:
我正在尝试将文本框放入 ASP.NET gridView 中的行数据绑定中。这里它没有在 cell.to 中正确调整以正确适应它。
我正在使用的行数据绑定
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "this.style.backgroundColor='orange'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
e.Row.Cells[2].Width = new Unit("700px");
TextBox txtAddress = new TextBox();
txtAddress.ReadOnly = false;
e.Row.Cells[2].Controls.Add(txtAddress);
e.Row.Cells[2].Style.Add("text-align", "center");
txtAddress.Text = e.Row.Cells[2].Text;
GridView1.Attributes.Add("style", "table-layout:fixed");
}
}
如何在网格单元格中正确放置。
【问题讨论】:
-
1000px? 360 像素?这些都是巨大的尺寸。
-
实际上它是一个评论字段......并且客户希望在gridview中看到完整的评论
-
将文本框的文本模式改为多行
-
完成或仍然没有得到你想要的
-
无法在 RowDatabound 中做到这一点...请举个例子
标签: c# asp.net .net gridview web