473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

header column span problems

i am trying to span header columns and am getting some problems. I
have 13 columns in my datagrid (1 template, 12 bound), and for some
reason, when i try to remove cells of index 11 or higher, it says the
index is not a valid index. Basically, I want the last 6 header
columns to span. Below is the code:

private void dgResults_ItemDataBound(object sender,
DataGridItemEventArgs e)
{
if(e.Item.ItemType==ListItemType.Header)
{
DataGridItem dgItem;
TableCellCollection tcells;
TableCell fcell;
TableCell scell;
dgItem = e.Item;
tcells = e.Item.Cells;
fcell = e.Item.Cells[0];
fcell.Text = "";
fcell = e.Item.Cells[1];
fcell.Text = "";
fcell = e.Item.Cells[2];
fcell.Text = "";
fcell = e.Item.Cells[3];
fcell.Text = "";
fcell = e.Item.Cells[4];
fcell.Text = "";
fcell = e.Item.Cells[5];
fcell.Text = "";
fcell = e.Item.Cells[6];
fcell.Text = "";
fcell = e.Item.Cells[7];
fcell.Text = "My Question goes here";
fcell.ColumnSpan = 6;
fcell.BackColor = System.Drawing.Color.Black;
scell = e.Item.Cells[8];
dgItem.Cells.Remove(scell);
scell = e.Item.Cells[9];
dgItem.Cells.Remove(scell);
scell = e.Item.Cells[10];
dgItem.Cells.Remove(scell);
scell = e.Item.Cells[11];
dgItem.Cells.Remove(scell);
scell = e.Item.Cells[12];
dgItem.Cells.Remove(scell);
}

}

it bombs out on the scell = e.Item.Cells[11]; line

Any ideas why?

Nov 23 '05 #1
0 899

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Chuck | last post by:
I have a report with three columns, accross then down, and two groups. Currently the group headers are only one column wide and appear in the left hand column. How can I make the group header be...
5
by: Stan | last post by:
I would like my header column span multiple columns, for example: Date Ready Open Close --------------------------- 08/06 10 am 5pm How can I do that? Thanks,
1
by: sri_san | last post by:
Hello, I have a datagrid in which the header needs to span over 2 columns. I have tried creating a tableCells and tableRow at runtime and set the columnspan property of a cell to 2. But, the...
6
by: tshad | last post by:
I have a datagrid where each column has both a label and a linkbutton. I need to have the label left justified and the linkbutton right justified. In HTML, I would have to set up 2 cells to do...
4
by: Mortar | last post by:
i need a datagrid with 2 header columns. The top one might have 1 column spanning 5 columns of the header row below it. what is the best way to do this? Could i have 2 datatables...1 filling the...
1
by: swc76801 | last post by:
I desperately need help. My understanding of CSS is non-existent. I have a store http://astore.amazon.com/texasheat-20 with Amazon.com. According to the information from Amazon.com "Write your own...
4
by: tirath | last post by:
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...
4
by: pedalpete | last post by:
I've just loaded some code up to my testing machine, and I get nothing but "cannot modify header" errors. I don't get these errors on my dev machine at all. I've gone through my code, and all...
11
by: shapper | last post by:
Hello, I am trying to create a header with a background color and a padding of the text. I know that if I apply the background color to the header it will expand 100%. So I did the following:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.