dragging images

G

Guest

In ASP.NET, what technology would I use to drag images around the screen?
Once the dragging is over, I'd need to fire an event in my codebehind using
the x/y of the new placement of the image.
 
K

Kevin Spencer

That would be done using JavaScript and DHTML. You should be able to easily
Google the subject now that you know what to look for.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Yeah, we've currently been using all javascript in our application. We'd
like to start moving it to a managed environment. However, we need a way for
the javascript functions (mouse up, down, etc) to invoke an event in the .NET
codebehind letting us know when we can get the current x/y. We're having a
hard time figuring out how to do that. This is why I was hoping to do some
of the javascript stuff in .NET.
 
K

Kevin Spencer

Hi Chris,

You don't really need to raise an event, unless you're working with a
Control. What you would need to do is use JavaScript to add information to a
hidden form field, POST the form back to the server, and read the hidden
form field on the server. Basically, it's the same mechanism as an event in
ASP.Net, but events are specifically associated with Controls.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
G

Guest

Well I am building server controls and I'm loading that javascript for. This
is a GIS application btw. So when a user drags the map image across the
screen (pan in the GIS world), that happens in javascript but I need my
control to know when that event is finished (mouse up) so I can get the new
coords and talk with the server for a new image. The same goes for zoom in,
zoom out, etc. We have all of the javascript code written as legacy, so
we're trying to find a way to make the ASP.NET server controls aware of when
these javascript events are firing and finishing.
 
B

billmiami2

Chris,

In your javascript function to handle the ondrop event (or whatever
drag/drop event you need to trigger a postback), make a call the
javascript function

__doPostBack('mycontrolname','params');

passing the name of a valid (but probably hidden) control in the page
and any parameters you need to communicate to the application. In the
page, pick up your pseudo event with an event handler

Sub WindowChanged(ByVal obj As Object, ByVal e As EventArgs) Handles
mycontrolname.Click

Parameters you passed in 'params' will be found in
Request.Form("__EVENTARGUMENT").

This is another way of doing what Kevin was suggesting and is what
I've done in the past with drag/drop web applications.

Bill E.
 
B

billmiami2

Chris,

In your javascript function to handle the ondrop event (or whatever
drag/drop event you need to trigger a postback), make a call the
javascript function

__doPostBack('mycontrolname','params');

passing the name of a valid (but probably hidden) control in the page
and any parameters you need to communicate to the application. In the
page, pick up your pseudo event with an event handler

Sub WindowChanged(ByVal obj As Object, ByVal e As EventArgs) Handles
mycontrolname.Click

Parameters you passed in 'params' will be found in
Request.Form("__EVENTARGUMENT").

This is another way of doing what Kevin was suggesting and is what
I've done in the past with drag/drop web applications.

Bill E.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top