saswat kumar

saswat kumar

  • 1.5k
  • 206
  • 27.9k

Asp .Net GridView

Jun 30 2017 3:03 AM
Hi,
  I have added  one row dynamically below gridview header for inline search.I want to get value of these textbox on postback.
 for dynamic row:
GridViewRow row = new GridViewRow(0,0, DataControlRowType.Header, DataControlRowState.Normal);
for (int i = 0; i < GridView1.Columns.Count; i++)
{
TableHeaderCell cell = new TableHeaderCell();
TextBox txtSearch = new TextBox();
txtSearch.Visible = true; txtSearch.Width = 140;
txtSearch.CssClass = "form-control";
txtSearch.ID = "txt1";
cell.Controls.Add(txtSearch);
row.Controls.Add(cell);
}
GridView1.HeaderRow.Parent.Controls.AddAt(1, row);
}
 
thanks 

Answers (1)