forum

Home / DeveloperSection / Forums / ListView and DataPager not working

ListView and DataPager not working

Anonymous User 2135 25-Aug-2014

I used a DataPager to page through ListView data. When ListView bound, DataPager show many pages below, everything seems to be ok but when i click to another page, After a postback, ListView is empty with EmptyDataTemplate and of course without pages.

    protected void DatapPager_OnPreRender(object sender, EventArgs e)
    {
        try
        {
            listView.DataSource = ((DataSet)ViewState[VIEWSTATE_DATASET]).Tables[0];
            listView.DataBind();
        }
        catch (System.Exception ex)
        {              
        }           
        base.OnPreRender(e);
    }
 
    protected void listView_OnPagePropertiesChanged(object sender, EventArgs e)
    {
        try
        {
            listView.DataSource = ((DataSet)ViewState[VIEWSTATE_DATASET]).Tables[0];
            listView.DataBind();
        }
        catch (System.Exception ex)
        {              
        }           
    }

In my case, ListView's data bound in a click event, not on PageLoad.

Anyone can helps me? Thank you so much!


Updated on 25-Aug-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By