Datagrid Paging with AutoGenerateColumns

S

swnshp

I have a Datagrid on a Form. AutoGenerateColumns is set to true,
AllowPaing is set to true, PagerStyle-HorizonalAlign is set to
"center".

I data bind the grid, then view the results. The problem is that the
Page numbers appear centred in a cell, that is the same width of the
first cell in the data, and is the only cell in the row, it has no
colspan. This obviously looks wrong, and has a grid line, what I need
is the page number to be aligned in the centre of the row.

I debugged into pre_render, and saw that the TableCell correctly had a
ColumnSpan equivalent to the number of columns, but it never renders
this attribute. I had originally thought maybe it wasn't going to
guess the number of columns in the data source(a wild excuse for this
behaviour).

If I set AutoGenerateColumns to false, and supply some dummy columns
and content, the page numbers align correcty. It's basically the same
table, but with the pager cell having a colspan. As the contents of
the grid are dynamic, and I deal with it in the datasource, I dont wish
to permantently make this false.

I have fixed this by adding finding the Pager Item's cell, and adding
the colspan attribute myself.

Can anybody explain why this behaviour occurs? (I am using IIS 6, ASP
..NET 2.0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top