Get or Set the position of a control in a page

  • Thread starter John Francisco Williams
  • Start date
J

John Francisco Williams

Hi all, how can I set the absolute position of a control on a webpage? The
control would be a server control and I need to be able to do this using the
code behind.

Thanks in advance,

Frank
 
J

John Francisco Williams

Thanks a lot. I used this, and worked for setting the values, even for
controls a flow layout pages. What I haven't found yet is how to get these
values out of a control in a flow layout page. Any suggestion?

Thanks again,

Frank

Tommy said:
You can definitely set the absolute position of a control.
The following is a sample code that will set the absolute position of
a button server control.

btnSubmit.Style["Z-INDEX"] = "102";
btnSubmit.Style["LEFT"] = "200px";
btnSubmit.Style["POSITION"] = "absolute";
btnSubmit.Style["TOP"] = "200px";

Tommy,

"John Francisco Williams" <[email protected]> wrote in message
Hi all, how can I set the absolute position of a control on a webpage? The
control would be a server control and I need to be able to do this using the
code behind.

Thanks in advance,

Frank
 
S

Steven Campbell

John said:
Thanks a lot. I used this, and worked for setting the values, even for
controls a flow layout pages. What I haven't found yet is how to get these
values out of a control in a flow layout page. Any suggestion?

Thanks again,

Frank

Eventually, when the page reaches the browser, the values are
implemented as CSS positioning. This is easy to do manually using divs,
e.g. <div style=...> place control here </div>. If you type that in
Visual Studio.NET html editor, the editor will even help you build the
style.

Better yet is to use an external stylesheet and ids, e.g. <div
id="menu"> place control here </div>. Then in the style sheet:
#menu
{
position: absolute;
top: 0px;
etc.
}


~Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top