Handle the mouse double click coordinates in the server segment

xiaoxiao2021-03-06  143

How to pass the coordinates of the mouse double-click on the web application to the server side and operate it? I will introduce this question, I hope to help everyone.

The double-click event of the mouse is a client event, which cannot obtain the coordinates of the mouse double-click point directly on the server, and cannot be effectively operated. Therefore, the need must be achieved through the combination of client events and server-side events.

Step 1: Create a client control

At the client we can create an HTML control. In the program, you can create an HTMLINPUTHIDEN control if you do not want the mouse double click on the coordinate display on the page. The controls I created are as follows:

Protected system.Web.ui.htmlcontrols.htmlinputhidden hidx;

Protected system.web.ui.htmlcontrols.htmlinputhidden hid;

If you want to double-click the coordinate, you can create the appropriate client control according to your needs.

Step 2: Create server-side controls

For the sake of simplicity display procedure, I created two Label controls and a Button control. as follows:

protected system.web.ui.webcontrols.label lblx;

protected system.web.ui.webcontrols.label lbly;

Protected system.Web.ui.webcontrols.button btnxy;

Step 3: Add client code

In order to pass the coordinates of the mouse double-click to two HTML controls in the form: write scripts: