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

[Solved] Filtering Detail Tables

7 Answers 213 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reid
Top achievements
Rank 2
Reid asked on 16 Mar 2009, 10:52 PM
I have a RadGrid that has one detail table.  Everything is working right except the filtering.  I have setup a custom Filter Template for the column that uses a RadComboBox to present a list of possible values the column would hold:

<telerik:GridBoundColumn DataField="ReconciledFlag" HeaderText="Reconciled Status" UniqueName="ReconciledFlag">  
<HeaderStyle Width="33%" /> 
<ItemStyle Width="33%" /> 
<FilterTemplate> 
 <telerik:RadComboBox runat="server" ID="cbClickActivityReconciledFlags" AutoPostBack="true" Skin="Hay"    OnSelectedIndexChanged="CickActivityFilterType_SelectedIndexChanged">  
  <Items> 
   <telerik:RadComboBoxItem Text="All" Value="All" /> 
   <telerik:RadComboBoxItem Text="Clicked" Value="Clicked" /> 
   <telerik:RadComboBoxItem Text="Paid" Value="Paid" /> 
   <telerik:RadComboBoxItem Text="Contested" Value="Contested" /> 
   <telerik:RadComboBoxItem Text="Archived" Value="Archived" /> 
   </Items> 
</telerik:RadComboBox> 
</FilterTemplate> 
</telerik:GridBoundColumn> 


I created a code behind handler that is fired when the RadComboBox's SelectedIndex changes:
protected void CickActivityFilterType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)     
{     
  RadComboBox cbReconciliationTypes = (RadComboBox) sender;     
  string selectedFilterType = cbReconciliationTypes.SelectedItem.Text;      
  string filterExpression = "([ReconcilationFlag] = '" + selectedFilterType + "')";     
  grdSponsoredLinks.MasterTableView.DetailTables[0].FilterExpression = filterExpression;     
}     

The code behind fires yet no filtering takes place.  I tried calling the Rebind() method of the detail table after the last line above and it does not help.

I also tried the following code:

protected void CickActivityFilterType_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)        
{        
  RadComboBox cbReconciliationTypes = (RadComboBox) sender;        
  string selectedFilterType = cbReconciliationTypes.SelectedItem.Text;         
  GridFilteringItem filterItem = (GridFilteringItem) cbReconciliationTypes.NamingContainer;    
filterItem.FireCommandEvent("Filter"new Pair("EqualTo", selectedFilterType));    
 
}     
 





7 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 Mar 2009, 04:26 PM
Hi Reid,

I followed your scenario and prepared a sample project for you. Try it on your end and let me know if it works as desired and if I missed something out.

For more information about FilterTemplate, please refer to the following live demo:
Filter Template

I hope this helps.

Sincerely yours,
Pavlina
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Reid
Top achievements
Rank 2
answered on 20 Mar 2009, 03:25 PM
Hello,

Because a solution (.sin) was not provided I was not able to get this working. 

But reviewing the code, can you please point out what is different other than the datasource and column name?
My code below is doing the exact same thing with one exception, my example is using a detail table.

Thank you

0
Pavlina
Telerik team
answered on 23 Mar 2009, 03:46 PM
Hello Reid,

Download the reattached project and give it a try. The solution file is provided. However, you could open the project as a WebSite, without the solution file.

Sincerely yours,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Reid
Top achievements
Rank 2
answered on 23 Mar 2009, 04:19 PM
Hello and thanks again for continuing this thread.

I am still unable to get this solution open.  I am using VS 2008 and assume you are using 2005 because the Conversion Wizard launches when I try to open the solution.

Error 1 Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. E:\Projects\Telerik Demos\FilterTemplate\FilterTemplate3\grid sample\Web.config 29 


Again, after reviewing the code in this latest example, the scenerios are different.  In my scenerio it is using a *detail* table.  The filtering is acting on a *detail* table, your example does not.  Have you tried it using VS 2008, .NET version 3.5 and filtering on a *detail* table?

Thanks
0
Pavlina
Telerik team
answered on 25 Mar 2009, 08:14 AM
Hi Reid,

I checked the project locally and everything seems to be alright. I am surprised that you are unable to get this solution open.
At this point in order to progress in the resolution of this issue I will ask you to open a formal support ticket and send me a small runnable application. Thus I will do my best to find a quick resolution of this issue.

Looking forward for your reply.

All the best,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Reid
Top achievements
Rank 2
answered on 25 Mar 2009, 02:11 PM
Please address the last paragraph of my last post.  I will say again, you are not providing code that works with a primary AND detail table.  In fact I believe the demos online filter the MasterTable view.  This is not the same in my case.  For instance when I call MasterTableView.DetailTables[0].ReBind() the primary MasterTableView's NeedsDataSource event is fired prior to the detail table's NeedsDataSource event, that does right to me.

And to reiterate the point  again about *me* creating a demo, the data is being pulled from a SQL database locally.  I provided a link to the template on my server for you to download, and I have asked what is different and am getting no reply, just a request for me to re-create it.  I have also followed threads in this forum recently on custom filtering that never were answered. 

So again, please either dissect my template or provide a solution that uses a RadComboBox (without databinding) that filters a *detail* table.

Thank you
0
Pavlina
Telerik team
answered on 30 Mar 2009, 10:14 AM
Hello Reid,

Unfortunately we can not determine the exact cause for the issue you encountered without a working demo, which demonstrates it. I suggest you modify the example I sent you or isolate a stripped working version of your project and send it attached to a formal support ticket. We will examine it in detail and will get back to you with additional information.

All the best,
Pavlina
the Telerik team

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