【问题标题】:change position panel改变位置面板
【发布时间】:2011-07-16 09:21:27
【问题描述】:
<table>
<tr><td>
<asp:Panel ID="PanelButtomEnter" runat="server" >
</asp:Panel>
</tr></td>
</table>
protected void brtnEnterProduct_Click(object sender, EventArgs e)
{
//how can change position panel
}
如何更改页面上的位置面板。
【问题讨论】:
标签:
asp.net
html
css
stylesheet
【解决方案1】:
更好的方法是使用样式。试试这个代码。
this.PanelButtomEnter.Styles.Add("Top","100");
this.PanelButtomEnter.Styles.Add("Left","100");
【解决方案2】:
首先,您有</tr></td>,但它应该是</td></tr>。
其次,在申请style.top和style.left的同时,还应该申请style.position="absolute",像这样:
this.PanelButtomEnter.Style.Add("position","absolute");
this.PanelButtomEnter.Style.Add("top","100px");
this.PanelButtomEnter.Style.Add("left","100px");
这 3 个值应该有效。
我希望这会有所帮助。
请参阅以下 MSDN 文章。
WebControl.Style Property
CssStyleCollection.Add Method