I use keyup but it does not fire. I populate innerHtml of div via GetRecords() from webmethod with a table and input text as a search. I click a button GetRecords fires, then webmethod is called. Then I create a table format on c# as table and input text.
function GetRecords() {
PageMethods.GetSavedList(onSucess, onError);
function onSucess(result) {
document.getElementById('allRecordsDiv').innerHTML = result;
}
function onError(result) {
alert("error..");
}
}
script side;
$("#mySearchInput").keyup(function () {
alert("aasdasd")
});
c# side;
[WebMethod]
[ScriptMethod]
public static string GetSavedList()
{
DataTable dt = DBoperation.GetAllRecords();
string html = "<table id= \"savedlist\" class=\"table table-hover\">";
//add header row
html += "<thead>";
html += "<tr> <input class=\"form-control\" id=\"mySearchInput\" type=\"text\" placeholder=\"Search..\"></ tr>";
html += "<tr>";
html += "<th> </th>";
for (int i = 0; i < dt.Columns.Count; i++)
{
html += "<th>" + dt.Columns[i].ColumnName + "</th>";
}
html += "<th> </th>";
html += "</thead>";
html += "<tbody id=\"mySavedListTable\">";
//add rows
for (int i = 0; i < dt.Rows.Count; i++)
{
//some rows
}
html += "</tbody>";
html += "</table>";
return html;
}