如何在gridveiw中检索动态创建的文本框的值
问题描述:
我正在更新gridview数据..........我在edititemtemplate中有文本框。现在我必须更新gridview中的值。我将如何从文本框中检索值并在数据库中更新它。请帮助我
I am updating gridview data ..........i have textbox in edititemtemplate. Now i have to update the value in gridview. how will i retrieve the value from textbox and update it in database ..Please help me
答
使用RowUpdating事件。
你可以找到你的文本框控件使用
Use RowUpdating event.
and you can find your textbox control using
TextBox txtName = (TextBox)Gridview1.Rows[e.RowIndex].FindControl("txtName");
string Name=txtname.Text;
使用此名称更新数据库。
Use this Name to update database.