Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

passing the position of a div tag to the server

Posted on 2006-11-24
10
Medium Priority
?
508 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 1000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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 …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Integration Management Part 2
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

927 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