Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is this possible to add a blank row in above the grid view header part

if possible then how can we achieve this???
Posted

Have a look at this CP article - Dynamic Multiple Row Column Grid Header[^] and adapt it to just have a blank row
 
Share this answer
 
Hi,

Try below one. It will create empty row on above header as per your requirement.

//Add databound event for gridview
protected void gvDividendReport_DataBound(object sender, EventArgs e)
{
//finding header control row
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);

//Creating header cell
TableHeaderCell cell = new TableHeaderCell();
cell.Text = "Customers"; //Naming to header. As you need empty row set as empty text

cell.ColumnSpan = 7; //Number of columns you have in gridview
row.Controls.Add(cell);
row.BackColor = ColorTranslator.FromHtml("#3AC0F2"); // Row background color if required

gvDividendReport.HeaderRow.Parent.Controls.AddAt(0, row);
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900