Solved

passing the position of a div tag to the server

Posted on 2006-11-24
10
489 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Replacing HTML tags in Textarea/Textbox 5 47
File Upload Control on a ASP.NET Overlay Page 1 42
Json and asp.net mvc 2 45
Error in JQuery 5 39
In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now