Using an Infragistics WebDataGrid v11.2 , how do I get the value typed into the filter box by the user, from the C# codebehind?
Say the column's Key="LastName" . After the webDataGrid performs the search on the value entered, I would like to get the string that was entered in the filter box using C# on the next PostBack.
for example something like:
string ln = wdgNames.Columns.FindItemByKey("LastName").FilterValue ;
or
string ln = wdgNames.Rows[0]Items.FindItemByKey("LastName").FilterValue ;
You need to handle grid DataFiltering
or DataFiltered
event, in there loop thru column filters (since you can have more than one) and get filter value according to column type.
For example the code snipped below gives access to string filters:
using Infragistics.Web.UI;
...
protected void grid_DataFiltering(object sender, GridControls.FilteringEventArgs e)
{
for (int I = 0; I < e.ColumnFilters.Count; I++) {
if (e.ColumnFilters[I].ColumnType == "string") {
//((GridControls.RuleTextNode)e.ColumnFilters[I].Condition).Value will give you the filter value
}
}
}