繁体   English   中英

ASP.net使用服务器端代码设置面板(Div)的顶部和左侧位置

[英]ASP.net set the Top and Left position of a Panel (Div) using server side code

我正在使用Visual Studio Express 2010,C#

我有一个div,需要在服务器端代码中设置其绝对位置(顶部,左侧)。 从服务器上的文件中读取div的位置。 我可以设置宽度和高度(也可以从文件中读取),但是到目前为止,我还无法找到设置位置的方法。

可能吗?

谢谢

您可以使用以下命令修改代码中的属性:

MyPanel.Attributes.Add("style", "position: [your_position]");

克里斯

您也可以这样设置

YourDivID.Style["position"] = "absolute";
YourDivID.Style["top"] = "20px"; //--- replace with your value
YourDivID.Style["left"] = "20px"; //--- replace with your value

祝好运!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM