Quantcast
Channel: .Net Core | MVC | HTML Agility Pack | SQL | Technology Crowds
Viewing all articles
Browse latest Browse all 544

System.Web.HttpException in .NET GridView Control

$
0
0

Sometimes while using Grid View control and setting .net GridView AllowPaging property True and not handling the paging in code behind it throws exception  "System.Web.HttpException: The GridView fired event PageIndexChanging which wasn’t handled" as shown  in picture  below:
System.web.HttpException in Grid View

This exception can be handled on PageIndexChangingevent of Grid View Control.

The code to solve this problem is given below:
protectedvoid grdstudent_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdstudent.PageIndex = e.NewPageIndex;
        Bind_Grid();
    }

Here grdstudent is the ID of the Grid View control. Change this one with your Grid View Id and Bind_Grid() method is used to Bind the grid view control with database. Replace this one with your method of binding the grid view control.
Hope this one sort out  your problem.



Viewing all articles
Browse latest Browse all 544

Trending Articles