I want to get the text of TextBox of gridview on Button click.
I am using following code:
source code-
CellPadding="3"
style="font-size: small; font-family: Arial">
cs file code:
protected void btninsert_Click(object sender, EventArgs e)
{
for (int i = 0; i <= Gridview1.Rows.Count - 1; i++)
{
TextBox txt1 = (TextBox)Gridview1.Rows[i].Cells[2].FindControl("TextBox1");
string str=txt1.Text;
}
but in str I am getting only space "". plz help me
Thanks in advance
SenthilkumarPosted Apr 13, 2012, 9:14 PM
VulpesPosted Apr 13, 2012, 1:58 PM
I'd try instead:
";
Label1.Text = str; // or however you want to display it