Search code examples
c#asp.netdatapager

Get number of clicked page in DataPager control


I have a Listview and a DataPager control on my page and I'm trying to create a custom paging (listview shows only interval of results). When user clicks on any page, DataPager_PreRender() event fires which contains my datasource/databind method.

Please tell me how to get the number of page that was clicked in datapager to use it in the PreRender method.


Solution

  • protected void ListView1_PagePropertiesChanging(object sender,PagePropertiesChangingEventArgs e)    
    {
    
        int CurrentPage = (e.StartRowIndex / e.MaximumRows)+1;
        Response.Write(CurrentPage.ToString());
    
    }
    

    http://forums.asp.net/p/1391359/2974778.aspx

    Hope this helps.