Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.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
如何从代码隐藏中获取gridview c#中的只读文本框值_C#_Gridview - Fatal编程技术网

如何从代码隐藏中获取gridview c#中的只读文本框值

如何从代码隐藏中获取gridview c#中的只读文本框值,c#,gridview,C#,Gridview,我有一个网格,我需要从gridview c#中的代码中获取只读文本框值您可以在aspx页面上自行完成 假设数据集从代码隐藏附加(绑定)到网格,现在进入aspx页面上的gridview,将textbox控件添加到网格,在textbox的text属性中,通过以下方式从数据集赋值- <%# Bind("your_column_name")%> 到文本框 谢谢你能发布你的代码吗?哦,有什么问题吗?如果您知道确切的坐标(行、列),则可以使用datagridview.Rows[rowIndex

我有一个网格,我需要从gridview c#中的代码中获取只读文本框值

您可以在aspx页面上自行完成

假设数据集从代码隐藏附加(绑定)到网格,现在进入aspx页面上的gridview,将textbox控件添加到网格,在textbox的text属性中,通过以下方式从数据集赋值-

<%# Bind("your_column_name")%>
到文本框


谢谢

你能发布你的代码吗?哦,有什么问题吗?如果您知道确切的坐标(行、列),则可以使用
datagridview.Rows[rowIndex].Cells[ColumnIndex].Value.ToString()
检索文本。
readonly = true 
protected void grd1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
           if (txt.Text != "")
            {
                txt.Attributes.Add("readonly", "readonly");
                txt.Visible = false;
                lbltaskname.Visible = true;
            }
            else
            {
                txt.Attributes.Remove("readonly");
            }
        }
    }