Get or Set the position of a control in a page

  • Thread starter Thread starter John Francisco Williams
  • Start date 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
 
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
 
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
 
Back
Top