Вопрос

Afternoon All,

I have a simple gridview with list items items that have been uploaded to file. I had an issue with paging on my gridview. As i selected page two the webpage would fail.

After looking aroud on the internet, i have seem that i need to add a PageIndexChanging' event to my gridview. I have tried to complete this via the following code but have a issue with e.NewPageIndex, this has an error that states... 'NewPageIndex' is not a member of 'System.Event.Args'.

Here is the vb for the PageIndexChanging event...

Protected Sub UploadedFiles_PageIndexChanging(ByVal sender As Object, ByVal e As System.EventArgs) Handles UploadedFiles_PageIndexChanging
    UploadedFiles.PageIndex = e.NewPageIndex
    UploadedFiles.DataBind()
End Sub

And here is my gridview code...

       <asp:GridView  ID="UploadedFiles" 
           DataSource="<%# GetUploadList() %>" 
           runat="server" 
           CssClass="mGrid" 
           Width="300px"   
           PagerStyle-CssClass="pgr" 
           AlternatingRowStyle-CssClass="alt"  
           CellPadding="4" 
           ForeColor="#333333" 
           AllowPaging="True" 
           PageSize="2" 
           AllowSorting="True" > 
        <AlternatingRowStyle CssClass="alt" />
        <PagerStyle CssClass="pgr" />
       </asp:GridView>  

Many thanks in advance for an help.

Regards Betty

Это было полезно?

Решение

Wrong signature - try this:

Protected Sub UploadedFiles_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) Handles UploadedFiles_PageIndexChanging

Другие советы

Take a look at the PageIndexChanging event on MSDN, notice that it doesn't take an EventArgs, it takes a GridViewPageEventArgs. GridViewPageEventArgs does have a NewPageIndex property.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top