views:

400

answers:

2

I started to work on a custom Gridview extension. I added some basic css stuff, looks ok, now I would like to move on. I never worked with custom control events.

I currently have an error "event PageIndexChanging which wasn't handled."

I have the MyGridview class in a something.aspx. I'd like to handle pagination in the MyGridview class (not in the something.aspx)

I thought I'd do it like this, because it will pretty much look the same in all the screens.

Can anyone tell me how can I create / override pagination stuff?

A: 

Rather than create a derived control, look at skinning it. Then you can handle the events as necessary from the standard control.

ck
A: 

You need to add this event:

protected void gvName_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView gvToPage = (sender as GridView);
    gvToPage.PageIndex = e.NewPageIndex;
}
Gavin Miller
I got the same errordar n! what am i doing wrong?
@Swoosh - sorry type-o; should be PageIndexChanging not PageIndexChanged. I'll update my answer.
Gavin Miller
ok, it kinda works, but this is not what i wanted.is there a way to move some "similar" code in the MyGridView's class file? so i wouldn't need this code in each list screen i use?thanks
If I'm not mistaken you ought to be able to use that directly in MyGridView class to capture the event.
Gavin Miller