如何从内容页调整母版页 div 的大小
我该如何将 div 的大小从页面调整为母版页?
将 div 设为服务器端控件似乎不是一个选项,因为所有应用的 css 都会因名称更改而中断,并且我无法修改 css 文件。
我已经尝试了 Hunter 使用 MasterType 的以下解决方案,然后在我的基本母版页中创建属性,但我的内容页面看不到公共属性。
我在其层次结构中列出了涉及的三个文件。
1) div 所在的基础母版页
2) 网站部分的母版页
3)我需要更改#1中的div的内容页面
How would I go about resizing a div from a page to it's master page?
Making the div a server side control doesn't seem to be an option as all applied css breaks from the name change and I cannot modify the css file.
I have tried the solution below from Hunter using the MasterType and then creating a property in my base master page, but my content page does not see the public property.
I have three files involved listed in their hierarchal structure.
1) Base master page where div resides
2) Master page for section of site
3) Content page for which I need to change the div in #1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试设置页面
MasterType
,这将允许您直接从页面操作MasterPage
上的成员所以在您的母版页中您可以添加如下属性:
然后在您的您可以将其添加到
<@ Page
行下方的 .aspx 内容中:这是母版页的命名空间和类。
然后,在页面代码后面,您应该能够像这样设置该属性:
有关 MasterType 指令的更多信息: http://msdn.microsoft.com/en-us/library/ms228274(v=VS.90).aspx
you could trying setting the pages
MasterType
, which will let you manipulate members on theMasterPage
directly from the pageSo in your master page you could add Property like this:
Then on your page you can add this to the .aspx content below the
<@ Page
line:which is the namespace and class of your Master page.
Then on the pages code behind you should be able to set that Property like so:
More on the MasterType directive: http://msdn.microsoft.com/en-us/library/ms228274(v=VS.90).aspx
也许有一种更简单(尽管不可否认不太干净)的方法可以做到这一点。为您的 div 指定一个未在样式表中定义的类,然后在页面上放置一个样式标记,如下所示:
当然,这要求您在 MasterPage 中有一个标头占位符。
Perhaps there is an easier (though admittedly less clean) method of doing this. Give your div a class which is not defined in your stylesheets, and then put a style tag on your page, like so:
Of course, this requires that you have a header placeholder in your MasterPage.