Calling server-side code from client-side

Hi, 

I´m implementing some shortcut functionality in my web forms and wanna know where i can find something that explains, for example, how to call the handler event "onclick" of a button. I´m using this library to add shortcuts to my controls:

http://www.openjs.com/scripts/events/keyboard_shortcuts/

 

And I want to "link" some key combination for the event handlers of the controls.

Does anybody knows?

 Thanks.

0
braudes
6/25/2007 6:31:12 PM
📁 asp.net.client-side
📃 24353 articles.
⭐ 1 followers.

💬 2 Replies
👁️‍🗨️ 560 Views

You could attach an AJAX event to the Javascript shortcut event handler so, for example, the shortcut function will trigger a button click which in itself is registered for an AJAX postback.  I tested it and it works...

<script>

shortcut("Ctrl+Shift+X",function() {

 

document.getElementById(
"Button1").click();

});

</script>

 

<asp:ScriptManager EnablePartialRendering="True" ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="up1" runat="server">

<ContentTemplate>

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

</ContentTemplate>

</asp:UpdatePanel>


"Never argue with an idiot; He will drag you down to his level and beat you with experience"
0
javiguillen
6/26/2007 3:43:19 PM

javiguillen,

thank you for the reply. It really works, but once per refresh. I wanna know what´s going on, because it executed once and after doesn´t work any more. I guess that the AJAX library are ovewriting the events used by the shortcut method. Can you or anyone give me some help? I tried to register the script via ScriptManager.RegisterClientScriptBlock but didn´t work either, because i was thinking that if I registered the script in every refresh I will have the shortcut method linked with the right event.

 Any help will be appreciate.

 Thanks

0
braudes
6/28/2007 3:04:31 PM
Reply: