paging in custom control
Hi,
I am building a custom control, wich display like treeview grid. Like parent and child grid like treeview.
Now the issue is paging. Can any one suggest how to proced for paging.
Till now my logic goes like this
Properties can be set like
mycc.conncetionstring =strConnection
mycc.ParentTableName =strTableName
mycc.ParentFromPart="*"
mycc.ParentCondition=strCondition
'Similarly for child grid
i am taking all this properties and generating tables with own logic writing out OnRener event custom conrol.
i am struck with paging. Can anyone help how to proced further
[646 byte] By [
Srinivasap] at [2007-11-19 11:47:30]

# 1 Re: paging in custom control
What i am understanding from your post is that you are not binding datagrid directly with data source instead you are rendering you datagrid through you own code ( which might be iterating each row of your data source and redering it in tr and td in table) . In that case i would suggest you to go for custom paing.
What i mean is rather then retrieving all the records just retrieve only those record which needed to be shown. render then in your own logic. Display four link button (or what ever interface you want) and define an event of their click in which u will set the current page number like below
protected void NavigationLink_Click ( Object sender, CommandEventArgs e )
{
switch ( e.CommandName )
{
case "First":
_currentPageNumber = 1;
break;
case "Last":
_currentPageNumber = Int32.Parse ( TotalPages);
break;
case "Next":
_currentPageNumber = Int32.Parse ( CurrentPage) + 1;
break;
case "Prev":
_currentPageNumber = Int32.Parse ( CurrentPage) - 1;
break;
}
BindData();
}
you have to keep track of current page by your self. Where in bind grid you will retrieve data according to your current page.
Hope fully above things help you. But you can find a lot of stuff on custome paging in data grid.
regards,