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