Your question is confusing. You say you have written some code in .cs file but do not know what to write in .aspx file? The title suggest you want to create gridview's header dynamically. For that bit try the following code:
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
GridView grd = (GridView)sender;
GridViewRow HeaderRow = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Insert);
TableCell HeaderCell = new TableCell();
HeaderCell.Text = "First Column";
HeaderCell.Style["font-weight"] = "bold";
HeaderRow.Cells.Add(HeaderCell);
HeaderCell = new TableCell();
HeaderCell.Text = "Second Column";
HeaderCell.Style["font-weight"] = "bold";
HeaderRow.Cells.Add(HeaderCell);
HeaderCell = new TableCell();
HeaderCell.Text = "Third Column";
HeaderCell.Style["font-weight"] = "bold";
HeaderRow.Cells.Add(HeaderCell);
grd.Controls[0].Controls.AddAt(0, HeaderRow);
}
}
For any other requirement than this, please edit your question and post again.