none
SharePoint 2010 - How to provide wild card search for the custom list

    Question

  • I have created a list view for the custom list using XSLTListView webpart. If I click on the column heading on any field, it displays all distinct values for me to filter. But I want something to be typed in the text box field for the user to filter. For example I have ItemCode in my list and I want to filter the ItemCode starting with "A". 

    ss

    Saturday, March 02, 2013 7:35 PM

Answers

All replies

  • Hi SS,

    You can use multivalue URL filter. something like below,

    http://mysite/pages/Items.aspx?FilterMultiValue=*A*&FilterName=ItemCode

    Hope this helps.

    Sunday, March 03, 2013 9:25 AM
  • Thanks for your response. I don't want to display another page with query string. I want to display the results in the same page. Is there any other better way?


    ss

    Tuesday, March 05, 2013 3:21 PM
  • Hi SS,

    You dont have to use another page. Just create a 'text box' and a search button in html and deploy as 'HTML Form Webpart'/'Content Editor Webpart' into your page. Then, write a simple JavaScript code to change the current page's URL from 'http://mysite/pages/Items.aspx' to 'http://mysite/pages/Items.aspx?FilterMultiValue=*{TextBoxValue}*&FilterName=ItemCode' on click of search button.

    Hope its clear and helpful.

    Wednesday, March 06, 2013 3:57 AM
  • Hi,

    Have a try to use text filter web part and SharePoint designer.

    1. Add a data view web part for the required list from SharePoint designer 2010 to the page
    2. Take the filter option of the  web part and add a Parameter.
    3. Add a Text Filter Web part from the designer
    4. Click on add connection

    For more detailed information, see

    http://coolsharepoint.blogspot.com/2012/03/sharepoint-2010-configure-textfilter-to.html

     

    Best Regards.


    Kelly Chen
    TechNet Community Support

    Wednesday, March 06, 2013 5:05 AM
    Moderator
  • Hi Kalai,

    Thank you very much for your response. Your solution works. When I type the URL along with the querystring parameters it works. Can you please let me know the code to change the URL by using javaScript?


    ss

    Wednesday, March 06, 2013 4:13 PM
  • Kelly Chen,

    Thank you very much for your response. When I looked into SharePoint designer 2010, I don't see Text Filter web part. Where should I download it from?


    ss

    Wednesday, March 06, 2013 4:16 PM
  • Hi,

    You don’t need to download it. Go to the list view page which added data view web part, find a place where you want to insert the text filter web part( like click div under/above the web part), then click insert , now click the web part narrow down, you will see the web part under filters section.

    Best Regards.


    Kelly Chen
    TechNet Community Support

    • Marked as answer by sSubraman Thursday, March 07, 2013 4:41 PM
    Thursday, March 07, 2013 2:21 AM
    Moderator
  • Thanks Kelly. I am able to get the Text Filter working. But in the filter criteria, I can't use wildcard characters in the comparison dropdown. The comparison criteria is only available for Equal, Not equal > etc.... Is there any way that I can use wildcard filters?

    ss

    Thursday, March 07, 2013 3:49 PM
  • Kelly, this issue is resolved. For the single line text and multi-line text, the comparison dropdown has the value of Beginwith... and Contains... etc. Hence there is no issue of using the wildcard filter. Thank you very much.


    ss

    Thursday, March 07, 2013 4:41 PM
  • Hi Kelly,

    Only when the user enters something on the TextFilter box, it should filter the records, otherwise by default it should show all the records. Is there anyway? Thanks in advance.


    ss

    Friday, March 08, 2013 4:15 PM
  • Hi SS,

    That's the default behavior of data view webpart. It will not display any records unless you put something in the filter text box. However, refer the below code to change the current page's URL using JavaScript,

    this.location.href = 'http://mysite/pages/Items.aspx?FilterMultiValue=*{TextBoxValue}*&FilterName=ItemCode';

    Hope this helps.

    • Marked as answer by sSubraman Monday, March 11, 2013 1:24 PM
    Friday, March 08, 2013 8:43 PM
  • Thanks Kalai. It helps.

    ss

    Monday, March 11, 2013 1:25 PM