This is a migrated thread and some comments may be shown as answers.

RadGrid Client Side filtering

2 Answers 572 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Angel
Top achievements
Rank 1
Angel asked on 06 Apr 2011, 05:53 PM

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

 

 

 

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Apr 2011, 09:53 AM
Hello Angel,

You can consider using declarative client-side binding along with paging/sorting/filtering like in this online demo:
Grid / Programmatic Binding

Thanks,
Princy.
0
Angel
Top achievements
Rank 1
answered on 14 Apr 2011, 06:56 PM
Tnks all works fine :D   A dude, when my aspx calls a pagemethod, this is server side call nou ?  how this manage ajax or how it works?? 


Tnks a lot ;)
Tags
Grid
Asked by
Angel
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Angel
Top achievements
Rank 1
Share this question
or