If your target browser is IE you could do something like this: function MyKeyHandler() { if(correctKeyPressed) { var btn = document.getElementById("myBtn"); btn.click(); //Simulates a click by causing the onclick event to fire. } }
Rob Koval
Posts
-
Default action -
button click without submiting the pageBe aware that button has two types of ocnlick events. Server side (the one that submits the page) and client side (the one you want) what you can do is to hav eboth attached to a button. However this cannot be done in design time. In page_load event you can do something like this to attach client side onclick handlers to your buttons: myBtn.attributes.Add("onclick","myJavaScriptFunction()"); another option is not to use server side buttons (not to user runat="server" attributes) r.
-
Confirm delete on DataGridYou need to add an event handler to datagrid for OnItemDataBound event. In that handler you need to lookup a delete button and attach client side script to it. You will do it using button's attribute collection. something like this: myBtn.Attributes.Add("onclick","javascript:myConfirmJSFunction()"); Hope this helps r.