GridView2.0\DisplayRecordsVertically

  • Thread starter Thread starter gh
  • Start date Start date
G

gh

I am using .net 2.0 and have a gridview, with the pager set to 10
records per page. I had a data list setup that displayed the contents
of a record in one column. I wanted to be able to use a pager, to
control the number of records per page, so I copied the template over
to a gridview and pasted it into the gridview item template. When I run
the web app. it displays the first 10 records as expected, but when I
click on the pager to goto the next page or another, the pages are
empty. Also I the pager selection count displays 1 through 10 and if I
click the next arrow after 10, nothing happens. Is the gridview
supposed to work, when displaying records in a cell this way?

TIA
 
I had a data list setup that displayed the contents
of a record in one column.

Is your intention to display each record as a gridview column and record's
fields as gridview rows (as suggested by the title above)?
 
Bogdan said:
Is your intention to display each record as a gridview column and record's
fields as gridview rows (as suggested by the title above)?

Bogdan:

I have a table(DataGrid), with one column, that displays each record as
a list. When the user clicks on the pager(next) the page refreshes with
the next 10 photos. I would like to display 4 rows across and 4 rows
down, with a pager. Each cell will contain an image, that is retrieved
by the url stored in a record. If the user clicks on the pager, to go
to the next set of records, then the datagrid will dislpay the next 16
images. I hope this explains

Thanks
 
I have a table(DataGrid), with one column, that displays each record as a
list. When the user clicks on the pager(next) the page refreshes with the
next 10 photos. I would like to display 4 rows across and 4 rows down,
with a pager. Each cell will contain an image, that is retrieved by the
url stored in a record. If the user clicks on the pager, to go to the
next set of records, then the datagrid will dislpay the next 16 images. I
hope this explains

Thanks

I think I get it now.

I can't see how you can utilize gridview and its paging capability without
going through some heavy customization. The default paging works with rows
but in your case there are no rows - just cells (not even columns).

If I were you I'd leave the gridview's default behaviour alone and modify
your object data source attached to the gridview so it supplies the info in
rows and columns. You could still read your images/urls as records from a
data store but you would pass them to the gridview as rows (i.e. 4 records
per row). If you do it in your code-behind (e.g. in your bll) then you have
a lot of flexibility.

Also, try to test the default gridview paging before you template it.
Simply enable the paging and make sure it works as expected first.

Finally, maybe the gridview is not the best choice in this case.

Bogdan
 
Back
Top