C# 是否在excel单元格中安装文本框?
我试图在ASP.NETC# 是否在excel单元格中安装文本框?,c#,asp.net,.net,gridview,web,C#,Asp.net,.net,Gridview,Web,我试图在ASP.NETgridView行数据绑定中安装一个文本框。在这里,它没有在单元格中正确调整。要正确安装它 我正在使用的行内数据绑定 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.A
gridView
行数据绑定中安装一个文本框。在这里,它没有在单元格中正确调整。要正确安装它
我正在使用的行内数据绑定
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");
}
}
如何在网格单元中正确安装它。我正在尝试这个方法,它工作正常
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;
//txtAddress.Style = "width:100%;";
txtAddress.Style.Add("width", "99%");
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");
}
}
100%在数学上是准确的,但99为我做到了:)1000px?360像素?这些都是巨大的尺寸。实际上这是一个注释字段…客户端希望在GridView中看到完整的注释将textbox的textmode更改为MultilineOne,或者仍然无法在RowDatabound中获得您想要的内容…请举个例子