Solved

passing the position of a div tag to the server

Posted on 2006-11-24
10
487 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 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