best way to do draging

D

David

I am creating a control (an image) on the server and Adding it to a Panel's
Controls collection. On the client side I want to drag the control to a new
location using the ondrag event to modify the style.top and style.left. On
ondragend the form is submitted. The first problem I am having is that after
the form is submitted the image is gone. This problem can be solved by
having the server sent the image to the client using the Panel's InnerHtml
property. Is there a way to get the control to persist across round trips
when it is added to the Panel using Controls.Add? The second problem is
getting the modifications of the style attribute made by client-side
javascript to persist. Can this be done by setting the right properties
somewhere? Some things seem to persist in the <DIV> without effort like
text. How can an added control be made to persist and how can the
client-side modified style attribute be made to persist.

THANK YOU in advance.

David
 
K

Kevin Spencer

Hi David,

To have the Control persist, you would have to add it back with each
PostBack.

To have the style information persist, you would have to store that
information somewhere in the page, for example in a hidden form field, when
it changes, then grab the hidden form field's contents on PostBack, and
write a startup script JavaScript that would re-set the style when the page
is returned to the browser.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
 

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

Top