Sivajihero Hero

Sivajihero Hero

  • NA
  • 105
  • 32.7k

display text in textbox inside gridview

Oct 20 2015 4:25 AM
I have a textbox inside the gridview. While I press enter in button click I need to display a text"New item" in textbox inside the gridview. Here is my code.

protected void Button16_Click1(object sender, EventArgs e)

{

Control control = null;

if (GridView1.FooterRow != null)

{

control = GridView1.FooterRow;

}

else

{

control = GridView1.Controls[0].Controls[0];

}

string Code = (control.FindControl("txtcode") as TextBox).Text;
Code="New item"// This I need to display.
}
 
txcode is the textbox which is inside the gridview. While I press button,the txtcode will display "new item".

Answers (1)