blah blah blah is here! blah blah » Close

up0down
link

Whenever I connect GridView control to my local database and make AllowPaging property "True" the error coemes like this:

" The GridView 'GridView2' fired event PageIndexChanging which wasn't handled. "

But when I connect it via a Sqldatasource control it works fine. Why it happens? Any idea?

last answered one year ago

2 answers

up0down
link

Hi try to add the following code..

protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView2.PageIndex = e.NewPageIndex;
BindGrid();
}


sorry, you've to bind the grid. mistakenly i've given the method BindGrid. thing is availability of datasource.

hope it helps,
Anil

up0down
link

Thanks for answering. But unfortunately it's not working. The error comes like this : the name "BindGrid" does not exist in the current context.
Besides, I want to know why this thing happens?
When there is a Datasource control like SqlDatasource serves in between, the AllowPaging property works fine but when I manually connect a GridView control directly to the Database, it gives that error:
"The GridView 'GridView2' fired event PageIndexChanging which wasn't handled."

Feedback