Hi.!
I have a Rad Grid control in my ASPX page, then I bind this control (server side binding) to a data table that I get from a web service. I want to implement a client side filtering, but I don’t know how to do this or what things I need to change in order to do that. I think this is possible, because all the information I got, is now in client side (My table with all the rows.!! )
I successfully implement server side filtering but this is very slow, so sadly this is not an option for me. :(
Here’s a sample of my code (server side filtering):
ASPX:
<
telerik:RadGrid
ID
=
"gdOrders"
AllowFilteringByColumn
=
"True"
runat
=
"server"
OnItemCommand
=
"onItemCmd"
>
<
MasterTableView
AllowFilteringByColumn
=
"True"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"CSOL_FOLIOOTID"
ShowFilterIcon
=
"false"
HeaderText
=
"Folio"
UniqueName
=
"CSOL_FOLIOOTID"
Resizable
=
"False"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
AllowFiltering
=
"true"
/>
.
.
.
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
CODE BEHIND
//My binding (Loading function)
myDataTable = myObjInstance.GetOrders();
gdOrders.DataSource = myDataTable;
gdOrders.DataBind();
protected
void
onItemCmd(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
switch
(e.CommandName)
{
case
RadGrid.FilterCommandName:
Pair filterPair = (Pair)e.CommandArgument;
TextBox filterBox = (e.Item
as
GridFilteringItem) [filterPair.Second.ToString()].Controls[0]
as
TextBox;
this
.ApplyFilter((
string
)filterPair.Second, filterBox.Text);
break
;
}
}
}
private
void
ApplyFilter(
string
clmnName,
string
value)
{
string
query = clmnName +
" like '%"
+ value.Trim() +
"%'"
;
gdOrders.DataSource = myDataTable.Select(query);
gdOrders.DataBind();
}
Can any one suggest me how to do this, what should I change or implement?
Tnks :D
Sorry for my English!!