Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 是否在excel单元格中安装文本框?_C#_Asp.net_.net_Gridview_Web - Fatal编程技术网

C# 是否在excel单元格中安装文本框?

C# 是否在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

我试图在ASP.NET
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中获得您想要的内容…请举个例子