I want to filter a grid at server side based on the value typed in a text box. And the filter should happen as the user types in text box. Since there is no server side event like keypress on a textbox, I decided to do use the client side onkeypress event and call a server side code using PageMethod. But then ran out with the limitation of PageMethod being static and I can’t access grid from server side code.
< form id="Form1" runat="server">
< asp:ScriptManager ID="ScriptManager" runat="server" EnablePageMethods="true" />
<input type="text" id="txtFilterLabName" onkeypress ="txtFilterLabName_Keypress()"/>
</form>
<script type="text/javascript">
function txtFilterLabName_Keypress() {
// Call a server method.
PageMethods.txtFilterLabName_Keypress();
}
</script>
[WebMethod]
public static void txtFilterLabName_Keypress()
{ // Code to filter the grid. }
Is there way to do this?