I am using the behaviors for Paging and Filtering, and catching the client event for :
WebDataGrid.Behaviors.Filtering.FilteringClientEvents.DataFiltered
The current page size I have set is 100, so the rows length return on the client side is the current page length. Obviously I can't do the total page count * the page size, because the last page maybe a partial page.
Also here is the current version of Infragistics I am using:
11.1.20111.2020
I have looked at the following post but does not seem to get what I needed.
http://forums.infragistics.com/forums/p/27700/299072.aspx#299072
Hi Chad,
Thank you for your reply and the provided code.
If you have any other questions, please feel free to contact me.
Nikolay-
I was able to accomplish what I need with your feedback. Thank you. I did some experimenting and thought since the code was a bit shorter on the server, I would give that as well. It does not appear that you need to do anything in the DataFiltering event, rather everything can be done in the DataFiltered event. Also the "GridResponse" response object has been depreciated and it looks like the "CustomAJAXResponse" is what you are suppose to use. Here is my code behind event handler:
private void grid_DataFiltered(object sender, FilteredEventArgs e) { WebDataGrid grid = sender as WebDataGrid; grid.Behaviors.Paging.Enabled = false; grid.CustomAJAXResponse.AdditionalProperties.Add("rowCount", grid.Rows.Count); grid.Behaviors.Paging.Enabled = true; }
The code on the client (aka javascript) remained basically the same, except for tweaks specific to my needs.
Thanks
Chad
Hi duhnamcd,
If you want to get the number of rows after filtering, I could suggest a possible solution. First disable paging in the DataFiltering server-side event. In DataFiltered event handler, get the number of rows in the grid, add the value to the AdditionalProperties collection and enable paging again:
protected void WebDataGrid1_DataFiltering(object sender, Infragistics.Web.UI.GridControls.FilteringEventArgs e)
{
((WebDataGrid)sender).Behaviors.Paging.Enabled = false;
}
protected void WebDataGrid1_DataFiltered(object sender, FilteredEventArgs e)
int filteredRowsCount = ((WebDataGrid)sender).Rows.Count;
((WebDataGrid)sender).GridResponse.AdditionalProperties.Add("rowCount", filteredRowsCount);
((WebDataGrid)sender).Behaviors.Paging.Enabled = true;
On the client, you can access this collection in the AJAXResponse event – for example:
var rows;
function AjaxResponseHandler(sender, args) {
var rowCount = args.get_gridResponseObject().AdditionalProperties.rowCount;
rows = rowCount;
document.getElementById("TextBox1").value = rows;
Please let me know if this helps.