Click to See Complete Forum and Search --> : Dynamically Dragable Label and Mouse Events


rolanty
09-29-2006, 09:11 AM
Hello,

I want to change the position of a label (or something else that can show text) dynamically in my ASP.NET (C#) page and I'm running out of solutions here:

1- I couldn't find the mouse controler events in webforms. Is there any way that I can specify mouse events in code (C#) section of my webform?

2- If there is no way I can handle mouse events, I can handle them in an application form (because as I've understood, mouse events are specified in System.Windows package, which doesn't exist in ASP.NET webform) and embed it to my webform. However, I don't know whether I can embed my application form into my webform (like adding an applet into HTML). Can I do that?

Is there another solution that I can accomplish my desire in my webform? Or do I need to change my design script to javascript or something else?

I'd be very glad if you show me a solution in this phase.
Regards..

sirpelidor
09-29-2006, 12:06 PM
Hi,

-the mouse event from System.Windows package is for window form application, not for web application.

-to register mouse event in a web browser, you'll need client-side javascript.

-if you are going to embedded application into webform, your best choice would be either implement in Java Applet, or Flash.

-what exactly is your logical condition in order to change the position of a label? if the position needs to be change base of some programming logics, what you can do is change the label (which render as span tag)'s style tag to "position:absolute;" and then you can change the label's position by telling it what the x and y is going to be (however, this -will- cause postback, meaning this is not a good idea to implement if you are doing this for some kind of form application).

-if the labels will only shows up in certain predefined spots, then maybe you can use it combine with many diff labels, and set display = false; and trigger them to display = true; based on certain event.

-for an example of a mouse drag label, see if something like this (http://12.181.161.39/dragtest/test.html) is what you need (i've put a lot of comments in the source code, it should be quite clear of what it is actually doing), again u don't want to combine this technique with anything which requires post back

hope this would be good enough to point you to the correct direction

rolanty
09-29-2006, 12:43 PM
Ok, thanks a lot.. I will direct myself to JSP..