In some cases, when the default filter row editor's functionality is not enough, you can provide custom filter cell content using the FilterTemplate.
In this example, a default cell editor is replaced with the ASPxGridLookup control. The control's ValueChanged client-side event is used to send a callback to the server side, invoking the grid's CustomCallback event. In the event handler, a filter criteria is created and applied to the grid using the ApplyFilterToColumn method.
Question Comments
Added By: jasanguineti at: 1/13/2014 7:12:39 AM
Please how set it filtertemplate in runtime?
thanks very much.
Added By: Ruslan (DevExpress) at: 1/13/2014 8:26:17 AMIt's quite simple.
You need create a class that implements the ITemplate interface and assign template object to the GridViewDataColumn.FilterTemplate property.
[C#]protectedvoidGrid_Init(objectsender,EventArgse){ vargrid=(ASPxGridView)sender; grid.DataColumns["CategoryName"].FilterTemplate=newCustomFilterTemplate();}...publicclassCustomFilterTemplate:ITemplate{ publicvoidInstantiateIn(Controlcontainer){ varlookup=newASPxGridLookup(); lookup.ID="Lookup"; container.Controls.Add(lookup); }}
[VB.NET]ProtectedSub Grid_Init(ByVal sender AsObject, ByVal e As EventArgs) Dim grid = CType(sender, ASPxGridView) grid.DataColumns("CategoryName").FilterTemplate = New CustomFilterTemplate()EndSub ...PublicClass CustomFilterTemplateImplements ITemplate PrivatepublicSub InstantiateIn(ByVal container As Control) Dim lookup = New ASPxGridLookup() lookup.ID = "Lookup" container.Controls.Add(lookup) EndSubEndClass