Why I am getting the following error: 'NewPageIndex' is not a member of 'System.EventArgs'

Why I am getting the following error: 'NewPageIndex' is not a member of 'System.EventArgs'

Here is the code:

Protected Sub GridView1_PageIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.PageIndexChanged
        GridView1.PageIndex = e.NewPageIndex
End Sub
LVL 3
Abdu_AllahAsked:
Who is Participating?
 
Wayne Taylor (webtubbs)Commented:
NewPageIndex is a member of DataGridPageChangedEventArgs, not System.EventArgs.
0
 
Wayne Taylor (webtubbs)Commented:
Hi Abdu_Allah,

What is it you are trying to do? If you are trying to set the PageIndex, there's no need, because it has already been changed. That's why that event was raised.

Regards,

Wayen
0
 
Wayne Taylor (webtubbs)Commented:
BTW - The reason you are getting that error is becase NewPageIndex is not a member of 'System.EventArgs', exactly as the error stated. You can only use those members available to a given object.
0
 
Abdu_AllahAuthor Commented:
>If you are trying to set the PageIndex, there's no need

Then why GridView paging does not work?!
0
 
Abdu_AllahAuthor Commented:
What is the alternative of NewPageIndex in ASP.NET 2.0?
In ASP.NET 1.1 NewPageIndex was a member of System.EventArgs.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.