【发布时间】:2016-03-03 07:59:24
【问题描述】:
我用 MasterFormClass.cs 添加 Body Control
protected override void OnInit(EventArgs e)
{
HtmlGenericControl NewControl = new HtmlGenericControl("div");
NewControl.ID = "LoadingSpinImage";
NewControl.Attributes.Add("style", "background-image: url('../../common/images/477.gif'); background-repeat: no-repeat; background-attachment: fixed; background-position: center; width: 100%; height: 98%; position: absolute; top: 1px; background-color: rgba(255,255,255,0.6);");
this.Form.Controls.Add(NewControl);
base.OnInit(e);
}
结果:
<html>
<body>
.... all control or element
.... all control or element
.... all control or element
<div id="LoadingSpinImage" style="width: 100%; height: 98%; position: absolute; top: 1px; background-image: url('http://preloaders.net/preloaders/495/Spinning%20segments.gif'); background-attachment: fixed; background-color: rgba(255, 255, 255, 0.6); background-position: 50% 50%; background-repeat: no-repeat;"></div>
</body>
</html>
但是...它添加到页面底部。我想在正文下方添加。
这一定是我想要的结果:
<html>
<body>
<div id="LoadingSpinImage" style="width: 100%; height: 98%; position: absolute; top: 1px; background-image: url('http://preloaders.net/preloaders/495/Spinning%20segments.gif'); background-attachment: fixed; background-color: rgba(255, 255, 255, 0.6); background-position: 50% 50%; background-repeat: no-repeat;"></div>
.... all control or element
.... all control or element
.... all control or element
</body>
</html>
【问题讨论】: