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

template filtering

9 Answers 143 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ibrahim
Top achievements
Rank 1
ibrahim asked on 19 Mar 2009, 09:55 AM
hey all
i am trying to filter through a combo box template..it is working fine but the issue is...i am filtiring by 3 categories..district,(largest)..support region and region(smallest)...when the filter of the district is changed i want the the regions and support regions found in that district to apear..i know i have  to change the select statment in the sql datasource...but i am using server side template filtering....and i dont know jscript...can i do it or should i change to serverside filtration??...thanks in advance

9 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 20 Mar 2009, 03:04 PM
Hi Ibrahim,

From the provided information I am not able to determine the exact source of the issue you are facing . At this point in order to progress in the resolution of this issue it will be best if you open a support ticket and send me a runnable project. Thus I will do my best to find a quick resolution of this issue.

Additionally more information about filter template, please refer to the following articles:
Help topic
Demo

Best wishes,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ibrahim
Top achievements
Rank 1
answered on 20 Mar 2009, 05:36 PM
the issue if in the first column i chose a district(or state) in the next i only want the cities in this district..i  have a table containing the data and i think i can do it if its server side but what if i wana do it client side(it is supposed to be faster in theory right?) thanks in advance pavina

0
ibrahim
Top achievements
Rank 1
answered on 22 Mar 2009, 08:58 AM
i tried the cliend side filtring and it still not working
it produced a expression expected error....here is my vbcode
 Protected Sub FilterCombo_SelectedIndexChanged_support(ByVal o As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
        Dim filterExpression As String
        filterExpression = "([support_zone] = '" + e.Value + "')"
        RadGrid2.MasterTableView.FilterExpression = filterExpression

        RadGrid2.MasterTableView.Rebind()

        zone_source.SelectCommand = "SELECT [Zone] FROM [Support_Zone_Zone] WHERE Support_zone=Support"
        zone_source.SelectParameters.Clear()
        zone_source.SelectParameters.Add("@support", TypeCode.String, e.Value.ToString)
        zone_source.DataBind()

    End Sub

i am working on this issue for 2 days :S please help ASAP
0
Pavlina
Telerik team
answered on 23 Mar 2009, 03:49 PM
Hi Ibrahim,

For more information about how to invoke filtering from the client, please refer to the following articles:
Programmatic Binding
Client-side Binding and Caching
fireCommand method

If you need further assistance, do not hesitate to let us know.

All the best,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ibrahim
Top achievements
Rank 1
answered on 23 Mar 2009, 07:44 PM
i want to do it from the server side:S
0
ibrahim
Top achievements
Rank 1
answered on 24 Mar 2009, 02:14 PM
i shouls set the EnableLinqExpressions=false in oreder for it to work
0
Pavlina
Telerik team
answered on 25 Mar 2009, 08:15 AM
Hello Ibrahim,

From the server side perspective, once an item in the combo is selected, and the SelectedIndexChanged event is raised, you can get the new value, and set the filter expression of the control accordingly. This will look like this:

ASPX:
<telerik:GridBoundColumn DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" 
UniqueName="CategoryName">  
<FilterTemplate> 
<telerik:RadComboBox runat="server" ID="FilterCombo" DataSourceID="AccessDataSource1" 
DataValueField="CategoryName" DataTextField="CategoryName" AutoPostBack="true" 
OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged">  
</telerik:RadComboBox> 
</FilterTemplate> 
</telerik:GridBoundColumn>  

VB:
Protected Sub FilterCombo_SelectedIndexChanged(o As Object, e As RadComboBoxSelectedIndexChangedEventArgs)  
 Dim filterExpression As String 
 filterExpression = "([CategoryName] = '" + e.Value + "')" 
 RadGrid1.MasterTableView.FilterExpression = filterExpression  
 RadGrid1.MasterTableView.Rebind()  
End Sub  

Additionally if this not helps, please open a formal support ticket and send us a small sample application that isolates the problem, so we can check it.

I hope this helps.

Sincerely yours,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
ibrahim
Top achievements
Rank 1
answered on 25 Mar 2009, 03:27 PM
ok it worked thank you...but 1 more thing when i do that the combo_box looses its selected index..
0
Pavlina
Telerik team
answered on 26 Mar 2009, 04:15 PM
Hi ibrahim,

Try to examine the code from the following live demo (the first RadGrid) and see if the approach there would work for you:
Filter Template

Note that the important properties that has to be synchronized are DataField/binding expression for the column and the SelectedValue for the combobox filter (which has to match the CurrentFilterValue of the column). The filtering is triggered intercepting the OnClientSelectedIndexChanged event of RadComboBox and calling the filter(colUniqueName, valueToCompare, filterFunction) client method of the grid.

I hope this helps.

Kind regards,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ibrahim
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
ibrahim
Top achievements
Rank 1
Share this question
or