Note that there are some explanatory texts on larger screens.

plurals
  1. POserver side filtering of data grid using jquery
    primarykey
    data
    text
    <p>I want to apply filter to my grid using jquery. The filter is working fine. But when i apply paging the filter does not search the entire database. So i am using ajax for server side filtering Here is my jquery code</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function () { $(".filtertable tr:has(td)").each(function () { var t = $(this).text().toLowerCase(); $("&lt;td class='indexColumn'&gt;&lt;/td&gt;") .hide().text(t).appendTo(this); }); $('#&lt;%=search.ClientID %&gt;').keyup(function () { var s = $(this).val().toLowerCase().split(" "); alert("21"); $.ajax({ contentType: "application/json; charset=utf-8", type: "POST", data:{'prefixText':s}, //data: "{data}", url: "AutoComplete.asmx/GetCompletionList", //data: "{}", dataType: "json", success: function (data) { for (var i = 0; i &lt; data.d.length; i++) { $('#&lt;%=search.ClientID %&gt;').append("&lt;tr&gt;&lt;td&gt;" + data.d[i].group_name + "&lt;/td&gt;&lt;td&gt;" + data.d[i].group_sname + "&lt;/td&gt;&lt;/tr&gt;"); } // $(".filtertable tr:hidden").show(); // $.each(s, function () { // $(".filtertable tr:visible .indexColumn:not(:contains('" // + this + "'))").parent().hide(); // }); }, error: function () { alert('Error!'); } }); }); }); &lt;/script&gt; </code></pre> <p>Here is my webservice method</p> <pre><code> public string[] GetCompletionList(string prefixText, int count) { //ADO.Net SqlConnection cn = new SqlConnection(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); String strCn = "/*data connection*/"; cn.ConnectionString = strCn; SqlCommand cmd = new SqlCommand(); cmd.Connection = cn; cmd.CommandType = CommandType.Text; cmd.CommandText = "select group_name,group_sname from group_master Where group_name like @myParameter"; cmd.Parameters.AddWithValue("@myParameter", "%" + prefixText + "%"); try { cn.Open(); cmd.ExecuteNonQuery(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); } catch { } finally { cn.Close(); } dt = ds.Tables[0]; //Then return List of string(txtItems) as result List&lt;string&gt; txtItems = new List&lt;string&gt;(); String dbValues; //String dbValues1; foreach (DataRow row in dt.Rows) { //String From DataBase(dbValues) dbValues = row["group_name"].ToString() + " " + row["group_sname"].ToString(); //dbValues1 = row["group_sname"].ToString(); dbValues = dbValues.ToLower(); //dbValues1 = dbValues1.ToLower(); txtItems.Add(dbValues); // txtItems.Add(dbValues1); } return txtItems.ToArray(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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