Hi Friends,
Iam doing one web application, in that i hav to filter gridview,
i hav done one sample gridview filter using jQuery, it works fine.
i hav done one sample gridview filter using jQuery, it works fine.
but whn im doing in main application i got error as "javascript runtime error:Object doesnt support property or method, quicksearch"
i am getting error in this set of code:
my code is:
HeaderStyle-BackColor="#87CEFA" OnRowDataBound="dgvDeplymentReport_RowDataBound"
OnRowDeleting="dgvDeplymentReport_RowDeleting" OnRowEditing="dgvDeplymentReport_RowEditing">
$(function() {
$('.search_textbox').each(function(i) {
$(this).quicksearch("[id*=dgvDeplymentReport] tr:not(:has(th))", {
'testQuery': function(query, txt, row) {
return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
}
});
});
});
same as i did in sample app as fallows:
runat="server" AutoGenerateColumns="false" OnDataBound="OnDataBound">
$(function () {
$('.search_textbox').each(function (i) {
$(this).quicksearch("[id*=GridView1] tr:not(:has(th))", {
'testQuery': function (query, txt, row) {
return $(row).children(":eq(" + i + ")").text().toLowerCase().indexOf(query[0].toLowerCase()) != -1;
}
} );
});
});
source code:
protected void OnDataBound(object sender, EventArgs e)
{
GridViewRow row = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
for (int i = 0; i < GridView1.Columns.Count; i++)
{
TableHeaderCell cell = new TableHeaderCell();
TextBox txtSearch = new TextBox();
txtSearch.Attributes["placeholder"] = GridView1.Columns[i].HeaderText;
txtSearch.CssClass = "search_textbox";
cell.Controls.Add(txtSearch);
row.Controls.Add(cell);
}
GridView1.HeaderRow.Parent.Controls.AddAt(1, row);
}
i hav added jQry plugin also..Pls help me
Thanks in Advance..
note i referred this link:http://www.aspsnippets.com/Articles/Search-GridView-records-data-on-TextBox-KeyPress-using-jQuery-in-ASPNet.aspx
2 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raja TPosted Aug 17, 2015, 8:46 AM
Raja TPosted Aug 17, 2015, 8:39 AM