c# - Adding operators in ASP.net gridview search using javascript/JQuery? -


i trying add filters asp.net grid view without post grid.

my grid contains 2 columns ..first column string type , second 1 number type.

i tried search working equals fine column one(string) want add greater , less operators numbers.

my current code below

  <asp:gridview id="gvsumain" runat="server" visible="false" autogeneratecolumns="false"                         onrowdatabound="gvsumain_rowdatabound" ondatabound="ondatabound">             <columns>                 <asp:templatefield headertext="category" headerstyle-width="200px" itemstyle-width="200px">                     <itemtemplate>                         <asp:hyperlink id="titlehyperlink" runat="server" text='<%# bind("category") %>'></asp:hyperlink>                     </itemtemplate>                     <headerstyle cssclass="gridheader" />                 </asp:templatefield>                 <asp:templatefield headertext="apps count" headerstyle-width="200px" itemstyle-width="200px">                     <itemtemplate>                         <asp:label id="lblappid" runat="server" text='<%# bind("appcounts") %>'></asp:label>                     </itemtemplate>                     <headerstyle cssclass="gridheader" />                 </asp:templatefield>             </columns>         </asp:gridview> 

in js

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>             <script type="text/javascript" src="js/quicksearch.js"></script>             <script type="text/javascript">             $(function () {                 $('.search_textbox').each(function (i) {                 $(this).quicksearch("[id*=gvsumain] tr:not(:has(th))", {                             'testquery': function (query, txt, row) {                                 return $(row).children(":eq(" + + ")").text().tolowercase().indexof(query[0].tolowercase()) != -1;                             }                         });                     });                 });             </script> 

and ,

 protected void ondatabound(object sender, eventargs e)         {             gridviewrow row = new gridviewrow(0, 0, datacontrolrowtype.header, datacontrolrowstate.normal);               // column 1             tableheadercell cell = new tableheadercell();             textbox txtsearch = new textbox();             txtsearch.attributes["placeholder"] = gvsumain.columns[0].headertext;             txtsearch.cssclass = "search_textbox";             cell.controls.add(txtsearch);             row.controls.add(cell);              // column 2             tableheadercell cell2 = new tableheadercell();             dropdownlist ddl = new dropdownlist();             ddl.items.insert(0, new listitem("=", "eq"));             ddl.items.insert(1, new listitem("<", "lt"));             ddl.items.insert(1, new listitem(">", "gt"));             textbox txtsearch2 = new textbox();             txtsearch2.attributes["placeholder"] = gvsumain.columns[1].headertext;             txtsearch2.cssclass = "search_textbox";             cell2.controls.add(ddl);             cell2.controls.add(txtsearch2);             row.controls.add(cell2);               gvsumain.headerrow.parent.controls.addat(1, row);         } 

is there way dynamic operator. have seen 1 solution not sure how integrate grid view it's jqgrid .

my current filter

dynamically setting toolbar search operator per column in jqgrid


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -