Click here to Skip to main content
15,889,200 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Dear All,

I am trying to learn user control ans also found some articles on web.

As I am not so much aware of web user contol.

I am not getting how this code works/flows. Simply not getting code.

For example in given link there is a example of custom GridView in which there is one method OnPageIndexChanging.

But where is code of OnPageIndexChanging method.

In given code parameters are passed to this method for changing page index,for changing page page size etc.

But i am not getting how this works and where is code.

Please see the link.

Custom Gridveiw Control with Custom Pager, Check Box Column, Serial Number Column, Custom Navigation
Posted
Updated 28-Nov-11 22:54pm
v3

It's a custom grid, so it's inheriting from GridView. It's simply raising the base class event OnPageIndexChanging, the declaration for that is in GridView. Use the IDE to browse the definition of the event (right mouse over OnPageIndexChanging -> go to defintion) and you will see where it is.
 
Share this answer
 
Comments
mayur csharp G 29-Nov-11 5:13am    
I did it...it goes to GridView[from metadata] file where i found protected virtual void OnPageIndexChanged(EventArgs e);

but when I expand it nothing is written there
mayur csharp G 29-Nov-11 5:33am    
one another question how javascript is running
Dylan Morley 29-Nov-11 5:39am    
From the other comments there, it looks like the author hasn't included the js file.

Basically any event is empty by default. we need to define the code in that events to carried it out.
Lets check about your Paging.

Have you define OnPageIndexChanging event on Page.
If yes then write following code in PageIndexChanging.
C#
GridView1.PageIndex = e.NewPageIndex;
//Bind grid Again.


To use paging in GridView you need to take care of following things
1. Give PageSize.
2. write PageIndexChanging event.
 
Share this answer
 
Comments
mayur csharp G 29-Nov-11 5:41am    
I had PageIndexChanging event before using this user controls dll and now also it is running well after adding dll of user control but features are added this time as defined in making usercontrol
mayur csharp G 29-Nov-11 5:44am    
my question is understand code
inthis case it just pass selected value and page size to OnPageIndexChanging event..so what is written in OnPageIndexChanging event

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900