After looking at the following article:
http://dotnetslackers.com/GridView/r...ta_Exists.aspx
I have come up with an idea that may solve your particular problem: If you
override a GridView and then override its CreateChildControls methods similar
to the following:
protected override int CreateChildControls(System.Collections.IEnumerable
dataSource, bool dataBinding)
{
int result = base.CreateChildControls(dataSource, dataBinding);
//create a new header row
GridViewRow row = base.CreateRow(-1, -1, DataControlRowType.Header,
DataControlRowState.Normal);
//convert the exisiting columns into an array and initialize
DataControlField[] fields = new DataControlField[this.Columns.Count];
this.Columns.CopyTo(fields, 0);
this.InitializeRow(row, fields);
// perform any manipulations with cells that you think are appropriate
// for example, you will need to add colspan attribute to cells 1 and 3,
change their captions, and remove cells 2 and 4
Table table = (Table)this.Controls[0];
table.Rows.AddAt(0, row);
return result;
}
Hope this helps
"tirath" wrote:
Quote:
hi,
I want to display data in on my web page, in gridview in this format:
Group A Group B
A1 A2 B1 B2
Test 1 1 2 1 2
Test 2 1 2 1 2
>
Group A is header to columns A1 and A2 and Group B is header to
columns B1 and B2.
How do i add header to columns A1 A2 and B1 B2?
>
I am using ASP.Net 2.0. Please help me. Is it possible with some other
control instead of gridview?
>
Thanks
>
>