Paging Problems

  • Thread starter Wesley Robinson
  • Start date
W

Wesley Robinson

I am having problems getting paging to work on one of my datagrid controls.
I am developing in Visual Studio.NET and I have tried using both the built
in MyDatagrid_PageIndexChanged event and tried making my own function and
calling it with the onpageindexchanged attribute of the datagrid element.
In either case, it never calls the function and simply reloads the page and
my datagrid vanishes. I am creating the datagrid dynamically by selecting a
table from a dropdown list then selecting what fields I want from a listbox
and hitting a select button. I am stumped. Does anyone have any ideas on
what I might be missing?

Thanks,
Wesley
 
I

Ian Oldbury

Hi Wesley

Does you codebehind page have the handles reference?

Private Sub grdPLOFDetail_PageIndexChanged(ByVal source As System.Object,
ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles
grdPLOFDetail.PageIndexChanged

And in the aspx file within the datagrid
have
allowpaging="True"

ian
 
W

Wesley Robinson

My code behind has the handles reference and allow paging is set to true. I
haven't had a problem setting up paging before, but for some reason in this
instance, when I select a page from the page index, it just calls Page_Load
but doesn't call the _PageIndexChanged function.

Thanks
 
I

Ian Oldbury

Sorry for the delay, we've had a holiday over here in the uk.

I've got a different signature for the PageIndexChanged event
ByVal source As System.Object

Sometimes we found that an event lost its link with the control, god knows
why. And the way to sort it was delete it(and all events to the grid) and
then add it again (just copying the code into notepad seemed to work).

To be honest i've no other idea's, which is no help whatsoever.
Sorry, but i'll keep thinking.

ian
 
W

Wesley Robinson

I think I've narrowed down (or perhaps broadened ) my problem to this, when
AutoGenerateColumns is set to False, I lose my datagrid whenever the page
executes a postback. When AutoGenerateColumns is set to True, I don't have
any problems but I need to be able to set AutoGenerateColumns = False.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top