Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp.net datagrid paging

Options
  • 20-06-2007 4:08pm
    #1
    Closed Accounts Posts: 82 ✭✭


    i have a datagrid on an asp.net form i applied default paging using the designer, but whenever i click on one of the buttons to go to the next page, the item command event fires.
    what else has to be done for the paging to work?


Comments

  • Registered Users Posts: 872 ✭✭✭grahamor


    i think the pageIndexChanged event needs to be called aswell.

    Have a search on Google, i found many tutorials on the built in paging before


  • Closed Accounts Posts: 82 ✭✭emoKILLER


    hi grahamor, im calling the PageIndexChanged method as well, but the item command method fires first, and gives an error (as no item was selected)
    here is the code

    private void dgResolutions_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
    {
    dgResolutions.CurrentPageIndex = e.NewPageIndex;
    BindDataGrid();
    }

    private void dgResolutions_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    { Response.Redirect("DisplayResolution.aspx?id="+e.Item.Cells[1].Text);
    }

    is there any way to just run the PageIndexChanged method when a new page is selected, without the item command method being ran. i looked on google, but i cant find any demos where there is both paging and item command are used


Advertisement