passing the position of a div tag to the server

Is there a simple way of getting the position of a div tag passed to the server so I can save it for later use.
I will be allowing the div to positioned using javascript (I will know the id of the div).

I have one idea of how to do it, but I would like a few suggestions to see if it they are along my line of thoughts.

Thanks

Jetforce
JetForceAsked:
Who is Participating?
 
Bob LearnedConnect With a Mentor Commented:
If you are looking for a more elegant way, I wouldn't have it.

Bob
0
 
Bob LearnedCommented:
Does the <div> element have an ID and a runat="server" attribute?

Bob
0
 
JetForceAuthor Commented:
The LearnedOne,
It has indeed.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Bob LearnedCommented:
C# example:

        HtmlContainerControl div = (HtmlContainerControl)this.FindControl("div1");

Bob
0
 
JetForceAuthor Commented:
OK
 I understand how to get the control, but how do I get its position on the form, ie top, left etc

Thanks
0
 
Bob LearnedCommented:
HtmlContainerControl div = (HtmlContainerControl)this.FindControl("div1");
string left = div.Style["LEFT"];
string top = div.Style["TOP"];

Bob
0
 
JetForceAuthor Commented:
that is fine, but it does not give me the new position where it has been moved to.

"I will be allowing the div to positioned using javascript!"

I only get the original position

Thanks
0
 
Bob LearnedCommented:
If you need to pass a value from client-side JavaScript to server-side code-behind, you could use a hidden element.

Bob
0
 
JetForceAuthor Commented:
exactly what I have done, but I was wondering if there was a more elegant way

thanks
0
 
JetForceAuthor Commented:
Bob,
  thanks for you help,

Jetforce
0
All Courses

From novice to tech pro — start learning today.