Solved

passing the position of a div tag to the server

Posted on 2006-11-24
10
502 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:JetForce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18018748
Does the <div> element have an ID and a runat="server" attribute?

Bob
0
 

Author Comment

by:JetForce
ID: 18037583
The LearnedOne,
It has indeed.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18037732
C# example:

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

Bob
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:JetForce
ID: 18052367
OK
 I understand how to get the control, but how do I get its position on the form, ie top, left etc

Thanks
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18053136
HtmlContainerControl div = (HtmlContainerControl)this.FindControl("div1");
string left = div.Style["LEFT"];
string top = div.Style["TOP"];

Bob
0
 

Author Comment

by:JetForce
ID: 18067903
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 18067930
If you need to pass a value from client-side JavaScript to server-side code-behind, you could use a hidden element.

Bob
0
 

Author Comment

by:JetForce
ID: 18069148
exactly what I have done, but I was wondering if there was a more elegant way

thanks
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 18069220
If you are looking for a more elegant way, I wouldn't have it.

Bob
0
 

Author Comment

by:JetForce
ID: 18072343
Bob,
  thanks for you help,

Jetforce
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question