繁体   English   中英

Aspx Web 应用程序包含渲染的 MVC 视图到可用屏幕尺寸

[英]Aspx Web App containing rendered MVC View to available screen size

我继承了一个旧的 web 应用程序,它主要是在 ASPX 页面内部编写的,并且正在努力将它迁移到 MVC,但是这个过程有点慢,因为我们只有两个/三个人,而且项目刚刚开始. 除了这项工作,我们还使用 DevExpress 控件。 因此,当我们加载页面时,它首先通过 ASPX(因为我们仍在使用 Site.Master 来处理菜单内容),然后调用 MVC 渲染操作,以在 ASPX 页面中加载视图。

<asp:Content ID="blah" ContentPlaceHolderID="anotherBlah" runat="server">
    <style>
        .container {
           position: relative;
           width: 100%;
           overflow: auto;
           max-width: 2150px;
        }
    </style>
    <div class="container">
        <%Path.To.MVC.RenderAction("Controller","Action" new {}); %>
    </div>
</asp:Content>

我如何以编程方式将最大宽度限制为屏幕的可用大小,以便 Controller 的内容不需要浏览器的滚动条?

DevExpress dxDataGrid 有它自己的内置滚动条,用户可以使用它。 问题是 ColumnPicker、添加新按钮、搜索或导出按钮的 go 一直到表格的最大宽度。 这就是为什么我想将它包含在屏幕的可用宽度内,并让 dxDataGrid 处理 rest。

我的一个朋友向我指出视口百分比。 这似乎是我一整天都在寻找的东西,所以如果其他人偶然发现了这个问题:点击链接阅读更多:

CSS 获取屏幕分辨率高度

我的解决方案:

<asp:Content ID="blah" ContentPlaceHolderID="anotherBlah" runat="server">
    <style>
        .container {
           position: relative;
           width: 93vw;
        }
    </style>
    <div class="container">
        <%Path.To.MVC.RenderAction("Controller","Action" new {}); %>
    </div>
</asp:Content>

暂无
暂无

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

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