Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datagrid PageIndexChanged event handling

Reply
Thread Tools

Datagrid PageIndexChanged event handling

 
 
Gopalan
Guest
Posts: n/a
 
      06-18-2005
Hi

I have got a Datagrid populated with a Dataset.

The first time the datagrid shows the first page data.

When I clicked the Next link to display the next page data it displays the
same data again.

I tested whether the event handling function is being called or not, it
seems it is not called when I click the Next button.

private void dgWebStatistics_PageIndexChanged(object sender,
DataGridPageChangedEventArgs e)

{

try

{

dgWebStatistics.SelectedIndex=-1;

dgWebStatistics.CurrentPageIndex = e.NewPageIndex;


}

catch(Exception Ex)

{

}

finally

{

}

}

Please help me in finding out the error in this.

Thanks

BG


 
Reply With Quote
 
 
 
 
Joe Fallon
Guest
Posts: n/a
 
      06-18-2005
Check your page load code.
You should only bind the data to the grid during initial page load not
during IsPostback.
--
Joe Fallon



"Gopalan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi
>
> I have got a Datagrid populated with a Dataset.
>
> The first time the datagrid shows the first page data.
>
> When I clicked the Next link to display the next page data it displays the
> same data again.
>
> I tested whether the event handling function is being called or not, it
> seems it is not called when I click the Next button.
>
> private void dgWebStatistics_PageIndexChanged(object sender,
> DataGridPageChangedEventArgs e)
>
> {
>
> try
>
> {
>
> dgWebStatistics.SelectedIndex=-1;
>
> dgWebStatistics.CurrentPageIndex = e.NewPageIndex;
>
>
> }
>
> catch(Exception Ex)
>
> {
>
> }
>
> finally
>
> {
>
> }
>
> }
>
> Please help me in finding out the error in this.
>
> Thanks
>
> BG
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?YWx2aW56X2M=?=
Guest
Posts: n/a
 
      06-18-2005
Ya, check the IsPostBack in the Page_Load(), and you forget to rebind the
datagrid after in the PageIndexChanged event there.

Good luck !
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid PageIndexChanged event doesn't fire vcinquini@gmail.com ASP .Net Datagrid Control 1 07-18-2006 08:45 AM
Datagrid PageIndexChanged event not firing Vijay ASP .Net Web Controls 0 08-24-2005 09:36 AM
Detecting a datagrid pageIndexChanged event in page_load =?Utf-8?B?TWlrZUc=?= ASP .Net 0 06-18-2004 12:08 PM
datagrid as Composite control... PageIndexChanged event don't get Fired!! Pls Help Kilic Beg ASP .Net Datagrid Control 0 06-08-2004 10:10 PM
DataGrid pageIndexChanged event not firing - simple solution steve ASP .Net Datagrid Control 0 12-16-2003 07:27 PM



Advertisments