Q: my Question is that , how can i get the value of text box which i built in gridview through the item template field?
i was try like this but i did not get the value
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2" ForeColor="Black" ShowFooter="True">
CommandName="Select" Text="Select">
string data;
protected void lbnSubmit_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
data = gvr.Cells[1].Text;
}
Response.Write(data);
}
reply soon please its urgent...
reply soon please its urgent...
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Amit ChoudharyRank #145 · 15.8K reputationPosted Jul 4, 2011, 2:27 AM EDT
Try this code:
protected void lbnSubmit_Click(object sender, EventArgs e)
{
string data= (TextBox)GridView11.Rows[1].Cells[1].FindControls("txtAnswer")).Text
Response.Write(data);
}
Thanks.
Faisal AnsariRank #3,366 · 427 reputationPosted Jul 4, 2011, 2:46 AM EDT
Its Working :)