Paging problem in VS.Net - datagrid disappears

A

Alan

I have a datagrid in VS.Net showing numeric paging and the first page of
data is displayed. Clicking on any other of the page numbers results in the
datagrid disappearing - no error message, but the entire datagrid is gone.
I have tried putting "AddHandler DataGrid1.PageIndexChanged, AddressOf
DataGrid_Page" in the page load to wire up the event (since
AutoEventWireup="false"). If I set a breakpoint in DataGrid_Page, it never
gets there.

Sub DataGrid_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex

Get_Data() ' datagrid is bound again in get_data()

End Sub

I made a very similar type of datagrid page in WebMatrix and the paging
works fine.
In VS.Net I am having this strange problem.

Thanks
Alan
 
A

Alan

I found the solution.
I am adding the columns to the datagrid in code. They need to be added to
the datagrid on every page change.
Also that is insufficient. An initial empty column needs to be predefined
using the following in the grid definition:
<Columns>
<asp:BoundColumn></asp:BoundColumn>
</Column>

Now the paging works.
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top