The first rows in my gridview are blank rows and these blank rows are used for searching values in my gridview. I am adding a blank row on every column but i don't want to add any blank row on the first column which is the ID for my data. I only want add the blank rows starting from the 2nd column. How can i do this? here is my code behind:
protected void OnDataBound(object sender, EventArgs e)
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
for (int i = 0; i < GV_EditProject.Columns.Count; i++)
{
TableHeaderCell cell = new TableHeaderCell();
TextBox txtSearch = new TextBox();
txtSearch.Attributes["placeholder"] = GV_Test.Columns[i].HeaderText;
txtSearch.CssClass = "search_textbox";
cell.Controls.Add(txtSearch);
row.Controls.Add(cell);
}
GV_Test.HeaderRow.Parent.Controls.AddAt(1, row);
}
here is my aspx file
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" ItemStyle-Width="5">
<ItemStyle Width="5px" />
</asp:BoundField>
HeaderTemplatecould be a good place to add search TextBox.