开发者

how to register( programmatically use) a mouse over event in c# and vb.net without using java script

i know how to make a mouse over event using html code and javascript

but

i am interested in knowing if there开发者_C百科 is a way of making the mouse over event using c# and/or vb.net.

i tried using the attribute.add for label, but doesnot work

please do provide code examples

thankyou

note

  • mouse over = on mouse over event
  • and any control please mainly button,link button, label, div.


Note that C#/VB.Net code executes on the server, before the actual page is sent down to the client browser. Once the page is sent, the only way to trigger C# code execution is for the client browser to make an HTTP request to the server.

By default the browser does not make HTTP requests on mouse events. Thus, the only way you can handle the mouse events is to have a client-side JavaScript code attached to the HTML element. That JavaScript code could execute an HTTP request (preferably AJAX) and pass the details about the mouse event to the server-side C# code, but if you take this route, please consider that network requests may result in battery power consumption and in charges for the user (if the user is on a metered cell network).

Of course, nothing prevents the C# code from generating the proper HTML element and corresponding JavaScript and sending them as part of the page down to the client, thus saving you at least writing the JS code to execute on page load.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜