简体   繁体   English

在ASP中动态添加控件时更改母版页中布局的高度

[英]Change the height of layout in master page when dynamically add a control in asp

![enter image description here][1]How can I change the height of the layout of the my page when the user adds new controllers. ![在此处输入图像描述] [1]当用户添加新控制器时,如何更改页面布局的高度。 I would like to enhance the height of my page when the user adds a new control. 当用户添加新控件时,我想提高页面的高度。

I am using in master page 我在母版页中使用

<div class="main">
     <asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</div>

and in my css 在我的CSS中

.main
{
    padding: 0px 12px;
    margin: 12px 8px 8px 8px;
    height: auto; 
}

One more question, can I achieve that programmatically in aspx.cs file ? 还有一个问题,我可以在aspx.cs文件中以编程方式实现吗?

Any advice would be appreciated. 任何意见,将不胜感激。 Thank you. 谢谢。

As long as your asp:Content has elements's in that have content in or a set height it should add to the height of the page 只要您的asp:Content具有元素的内容或设置的高度,它就应该添加到页面的高度

example

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<div>

</div>
</asp:Content>

Also need to check for CSS styles that are altering the height of div's as this will effect any content you place in there 还需要检查是否更改了div高度的CSS样式,因为这会影响您放置在其中的任何内容

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

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