About Filtering by combobox RRS feed

  • Question

  • Uh, Hello, I'm now trying to find the way to use my ComboBox to do filtering with my datagrid, I did apply with textbox to find the descriptions and it works well. So I'd like to ask you about the way to use ComboBox to do filtering as textbox (For example, I need to filter my table's name "City") and I also need to know about how to filter Datetime. I've read many tutorials, but it looks complicated and most of them use riadata: to control, moreover my VS2012 doesn't have riadata either. I don't know why. 

    Well, I create my application with ADO.NET and DomainService, so I wanna use riacontrol to do filtering, if somebody has already known something about this, please tell me. I'd be appreciated to hear your answer. Thank you verymuch

    Here's my code to search by using text box:

                    <riaControls:FilterDescriptor  PropertyPath="Name"  Operator="Contains" IgnoredValue=""  Value="{Binding ElementName=TextSearch, Path=Text}">
    <TextBox x:Name="TextSearch" HorizontalAlignment="Left" Margin="240,0,0,0" VerticalAlignment="Top" Width="36" Height="20"/>
    I'm looking forward to see your answer,

    Thank you very much

    Friday, November 23, 2012 9:14 AM

All replies

  • Hi,

    Please try replace textbox with combobox.

     <riaControls:FilterDescriptor  PropertyPath="Name"  Operator="Contains" IgnoredValue=""  Value="{Binding ElementName=comboBox1, Path=Text}">             

     <ComboBox Height="23" HorizontalAlignment="Left" Margin="119,122,0,0" Name="comboBox1" VerticalAlignment="Top" Width="120" SelectedIndex="-1">

    Best Regards

    Monday, November 26, 2012 1:36 PM
  • Hi, I did follow as your suggestion, at first, there some error shows me that I can not bind text data by using operator"Contains" So I changed to "IsEqualTo" but the result I got is nothing, everything is blank even my datagrid view. Do you have any idea about this? 

    Here's my code:

    <riaControls:FilterDescriptor  PropertyPath="Name" Operator="IsEqualTo" IgnoredValue=""  Value="{Binding ElementName=FilterComboBox, Path=Text}">
    <ComboBox x:Name="FilterComboBox" HorizontalAlignment="Left" Height="20" Margin="62,0,0,0" VerticalAlignment="Top" Width="93"  SelectedIndex="-1">

    I thank you for your response and looking forward to see your reply again,

    Best Regards

    Monday, November 26, 2012 2:11 PM
  •  hi,

           on selected item you can cast your combobox with your binding class to get value as a textbox.

           filter date on entity framework


           LINQ date range search


    Regards atik sarker

    Tuesday, November 27, 2012 3:12 AM