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 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amit ChoudharyPosted Jul 4, 2011, 6:27 AM
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 AnsariPosted Jul 4, 2011, 6:46 AM
Its Working :)