|
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
|
|
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!
|
|
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
|
|
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!
|
|
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
|
|
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!
|
|
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
|
|
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!
|
|