how can i filter master data based on details data using RadDataFilter

2 posts, 0 answers
  1. Syed Waqas
    Syed Waqas avatar
    5 posts
    Member since:
    Nov 2012

    Posted 27 Mar 2013 Link to this post

    i have a collection of type Responses to questionnaires and each response has collection of answers, how can i filter Responses based on answers.below is the example

    <P><telerik:RadDataFilter telerik:StyleManager.Theme="Office_Blue"
    Grid.Row="1" Source="{Binding Items, ElementName=dg_reports}"
    AutoGenerateItemPropertyDefinitions="False" Name="rdfilter_report"
    Loaded="rdfilter_report_Loaded"/><BR>       
    <telerik:RadGridView Grid.Row="2" Name="dg_reports"
    telerik:StyleManager.Theme="Office_Blue" ShowGroupPanel="False"
    IsReadOnly="True" AutoGenerateColumns="False"
    RowIndicatorVisibility="Collapsed"><BR>           
    <telerik:RadGridView.Columns><BR>               
    <telerik:GridViewToggleRowDetailsColumn/><BR>               
    <telerik:GridViewDataColumn DataMemberBinding="{Binding
    Path=Company.CompanyName}" Header="Company" Width=".40*"
    HeaderTextAlignment="Center"/><BR>               
    <telerik:GridViewDataColumn DataMemberBinding="{Binding
    Path=Contact.ContactName}" Header="Contact" Width=".40*"
    HeaderTextAlignment="Center"/><BR>               
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=CreatedDate}"
    Header="Date" Width=".20*" HeaderTextAlignment="Center"
    DataFormatString="dd/MM/yyyy
    HH:mm"/><BR>           
    </telerik:RadGridView.Columns><BR>           
    <telerik:RadGridView.RowDetailsTemplate><BR>               
    <DataTemplate><BR>                   
    <telerik:RadGridView telerik:StyleManager.Theme="Office_Blue"
    ItemsSource="{Binding Path=ResponseAnswers}" AutoGenerateColumns="False"
    Margin="10" ShowGroupPanel="False"
    IsReadOnly="True"><BR>                       
    <telerik:RadGridView.Columns><BR>                           
    <telerik:GridViewDataColumn DataMemberBinding="{Binding
    Path=Question.QuestionText}" Header="Question" Width="560"
    HeaderTextAlignment="Center"/><BR>                           
    <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Answer}"
    Header="Answer" Width="550"
    HeaderTextAlignment="Center"/><BR>                       
    </telerik:RadGridView.Columns><BR>                   
    </telerik:RadGridView><BR>               
    </DataTemplate><BR>           
    </telerik:RadGridView.RowDetailsTemplate><BR>       
    </telerik:RadGridView></P>

     and here is the codebehind

    <P> </P>
    <P>private void RATxt_questtionnaire_SelectionChanged(object sender,
    Telerik.Windows.Controls.SelectionChangedEventArgs
    e)<BR>       
    {<BR>            if
    (RATxt_questtionnaire.SelectedItem !=
    null)<BR>           
    {<BR>               
    //report_filter.Source =
    ((Questionnaire)(RATxt_questtionnaire.SelectedItem)).Questions;</P>
    <P>               
    DC = new
    QuestionnairesDomainContext();<BR>               
    DC.Load(DC.GetResponseByQuestionnaireQuery(((Questionnaire)(RATxt_questtionnaire.SelectedItem)).QuestionnaireId),
    Operation
    =><BR>               
    {<BR>                   
    dg_reports.ItemsSource =
    Operation.Entities;<BR>               
    }, null);<BR>           
    }<BR>        }</P>
    <P><BR><BR>private void rdfilter_report_Loaded(object sender, RoutedEventArgs
    e)<BR>       
    {<BR>           
    ItemPropertyDefinition priorityDefinition = new
    ItemPropertyDefinition("ResponseAnswers.Count", typeof(int),
    "Answer");<BR>           
    rdfilter_report.ItemPropertyDefinitions.Add(priorityDefinition);<BR>       
    }</P>
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 27 Mar 2013 Link to this post

    Hi,

    This online example shows how you can filter on the Count property of a collection which is a property of the master business object. The RadDataFilter can be filtered on Squad Size which is the Count of Players that each Club has.

    You can only filter on properties of the child collection such as Count, but cannot drill-down inside its members -- the LINQ data engine does not support such kind of filtering.

    Regards,
    Rossen Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top