Welcome Guest Search | Active Topics | Sign In | Register

Paging on Gird Options
WS
Posted: Thursday, March 3, 2011 5:23:37 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

I've set the grid for paging, but I am not sure how to implement in PageIndexChanged event since there is no PageIndex property I can set.

Can you give me the solution to solve this?

Thanks
William

eo_support
Posted: Thursday, March 3, 2011 5:33:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

The property is CurrentPage. When user switches to another page on the client side (when the Grid runs in Server or Callback mode), your PageIndexChanged event is fired.

Thanks!
WS
Posted: Thursday, March 3, 2011 5:42:34 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Can you show me in code how to implement it?

protected void myGrid_PageIndexChanged(object sender, EventArgs e)
{
?????? myGrid.CurrentPage
myGrid.DataBind();
}

Thanks
William
eo_support
Posted: Thursday, March 3, 2011 6:06:54 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That will completely depend on how you do your paging. The Grid displays a page of data you give to it. It does not actually page the data for you. Usually only you know how to page your data with SQL. So basically you will need to construct a data source that represents ONLY data on the nth page and then give that data source to the Grid.

The Server Running Mode sample in the sample project demonstrated one way to page the data, which you can take a look. However that is only to show you the idea. Your data/db structure may be completely different so it may not apply to you.

Thanks!
WS
Posted: Thursday, March 3, 2011 10:38:07 PM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

I am currently using ObjectDataSource as dataSource bind to Grid, I have dedfined SelectMethod and SelectCountMethod see below, also GetDataCheck can return data from DB when proper paraments passed!

<asp:ObjectDataSource ID="DataCheckObjectDataSource" runat="server"
SelectMethod="GetDataCheck" EnableViewState="False" SelectCountMethod="GetDataCheckRowCount" TypeName="BusinessLogic.DataCheckingBLL"
EnablePaging="True" SortParameterName="sortExpression" OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:ControlParameter ControlID="ddlProject" Name="projectId"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="txtDateFrom" Name="fromDate"
PropertyName="Text" Type="DateTime" />
<asp:ControlParameter ControlID="txtDateTo" Name="toDate" PropertyName="Text"
Type="DateTime" />
</SelectParameters>
</asp:ObjectDataSource>

my understanding is that when GetDataCheck event is called it should pass these 3 paraments,
ie. maximumRows, startRowIndex, sortExpression which they are set in both ObjectDataSource and Gird, but when I debug I can't see any in maximumRows, ie. maximumRows = 0

Can you explain to me is there any defference between EO.Web.Grid and ASP.NET GridView ?

Thanks in advance,
William





eo_support
Posted: Friday, March 4, 2011 9:13:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Our Grid does not support paging on data source control yet. Currently it always passes DataSourceSelectArgument.Empty to the Select method. We will look into it and see if we can add that.

Thanks!
WS
Posted: Monday, March 7, 2011 3:05:31 AM
Rank: Advanced Member
Groups: Member

Joined: 2/27/2011
Posts: 37
Hi,

I have changed to use DataTable as DataSource bind to Grid, paging is working now except sorting, I am wondering how to use Property SortColumn and e.Column in ColumnSort event as I've read document but no help.

Cheers,
William
eo_support
Posted: Monday, March 7, 2011 9:08:31 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You would just pre-sort your DataTable based on e.Column.SortOrder. The Grid won't sort it for you in server/callback mode. It gives you all the information (page index, page size, sort order) and you are responsible to produce the data based on those information.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.