Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Method String.Contains performs case-sensitive and culture-insensitive comparison, so if you want case-insensitive contain use IndexOf method like</p> <pre><code>title.IndexOf(r.Title, StringComparison.InvariantCultureIgnoreCase) &gt;= 0 </code></pre> <p>but in your code you fetch all items and filter record there, if List will contain many items, this way is not recommended, as it involves getting all items from list. Maybe it’s better use <a href="http://msdn.microsoft.com/en-us/library/ms462365.aspx" rel="nofollow">CAML Query</a> (or <a href="http://msdn.microsoft.com/en-us/library/ee537339.aspx" rel="nofollow">LINQ in Sharepoint2010</a>). What do you want to find? Items where fields Title/City/Address contain value from vars title/city/address or you want find items where fields Title/City/Address value contained in vars title/city/address. In 1st case your CAML will be like:</p> <pre><code>List&lt;SearchEntity&gt; results = new List&lt;SearchEntity&gt;(); var title = tbTitle.Text; var adress = tbAdress.Text; var city = tbCity.Text; var query = new SPQuery() { Query = string.Format( @" &lt;Where&gt; &lt;Or&gt; &lt;Or&gt; &lt;Contains&gt; &lt;FieldRef Name=""Title"" /&gt; &lt;Value Type=""Text""&gt;{0}&lt;/Value&gt; &lt;/Contains&gt; &lt;Contains&gt; &lt;FieldRef Name=""Adress"" /&gt; &lt;Value Type=""Text""&gt;{1}&lt;/Value&gt; &lt;/Contains&gt; &lt;/Or&gt; &lt;Contains&gt; &lt;FieldRef Name=""City"" /&gt; &lt;Value Type=""Text""&gt;{2}&lt;/Value&gt; &lt;/Contains&gt; &lt;/Or&gt; &lt;/Where&gt;", title, adress, city) }; var items = list.GetItems(query); foreach (var item in items) { var result = new SearchEntity { title = item.Title, adress = (string)item["Adress"], city = (string)item["City"], }; results.Add(result); } return results; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload