Changing a server control property using JavaScript

D

Dave

I have an ASP.NET composite server control "Panel" if you
will, that has another server control on it. This second
server control is movable and resizable entirely in
JavaScript. I would like this second control to retain
it's size and position when another control on the page
posts back. How do I update the second control's
properties when they change on the client side in
JavaScript?

I have been able to cause an auto-postback when the
control is manipulated client side, but I have been
unable to find a way to have the second control maintain
the state it had before the postback. I would like to
update the second control's properties without posting
back if it is possible.

I have also fooled around with the __doPostBack function,
but I don't think I'm using it correctly.

If anyone could show me some example code that
demonstrates the recommended way to do this, I would
appreciate it.
 
J

John Saunders

Dave said:
I have an ASP.NET composite server control "Panel" if you
will, that has another server control on it. This second
server control is movable and resizable entirely in
JavaScript. I would like this second control to retain
it's size and position when another control on the page
posts back. How do I update the second control's
properties when they change on the client side in
JavaScript?

Your question is really more general: how do I get the client to affect the
server?

In your case, the answers are hidden form fields or cookies. You have the
client-side JavaScript update the field or cookie, which will be sent to the
server on postback. The control would then interpret the field as a place to
get its properties from.

Cookies have the advantage that they also work on an initial request, in
addition to working on PostBack.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top