Return All Filtered Results Server Side

1 reply. Last post: January 18, 2010 11:27 PM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Rob SmithMember

Hello

We are using WebGrid version 6.

We want to find out how to get a list back of filtered rows server side. I assume this must be easy and we are missing something obvious.

For example, the grid could display say 500 rows over say, 20 pages. The user could then filter these results to return say 75 rows over 3 pages. We want to find out these filtered rows could be discovered server side. So we could have a button at the bottom of the page for example "do something to filtered results".

At present we are checking the RootTable.Rows property but this just gives us all rows on the current page only.

Find attached a small code snippet of the essential code we use

<iswebgrid:webgrid 
id="WebGridMain"
runat="server"
allowautodatacaching="false"
onexport="WebGridMain_Export"
onupdaterow="WebGridMain_UpdateRow"
ondeleterow="WebGridMain_DeleteRow" >

<LayoutSettings
AllowColumnFreezing="Yes"
AllowDelete="Yes"
AllowEdit="Yes"
AllowExport="Yes"
AllowFilter="Yes"
AllowSorting="Yes"
AlwaysShowHelpButton="False"
HeaderClickAction="SortMulti"
AutoHeight="true"
FocusNewRowOnLastCell="True"
GridLineColor="#DCB0C8"
GridLines="Vertical"
CellPaddingDefault="5"
PagingMode="ClassicPaging"
PagingExportMode ="ExportAllData"
PagingSize="25"
PagingLoadMode="Automatic"
PagingStyleUI="FirstPrevNextLast">

<FreezePaneSettings AbsoluteScrolling="true" ShowInContextMenu="True" />

<various styles etc..............>

</LayoutSettings>

</iswebgrid:webgrid>



/// <summary>
/// Populate the grid with the correct data
/// </summary>
public void Populate()
{
// Fill in the grid datasource
WebGridMain.DataSource = GridManager.PopulateGridData();

// Do the databind
if (!IsPostBack)
{
WebGridMain.DataBind();
}
else if (IsPostBack)
{
WebGridMain.RebindDataSource();
}
}

//
// ***This is where we want the filtered result set so we can do something to them***
//
private void AButtonClickEvent()
{
// We are using RootTable.Rows but this only gives us the filtered result set for the current page
WebGridRowCollection rows = WebGridMain.RootTable.Rows;

// Do something with rows here -

}


Thanks



All times are GMT -5. The time now is 7:48 PM.
Previous Next