简体   繁体   English

局部视图渲染不正确(ASP.NET MVC)

[英]Partial View rendering not correctly (ASP.NET MVC)

I have modal dialog opening by click 我可以通过单击打开模式对话框

Modal body is Partial View 模态主体为局部视图

Here is code of partial view 这是部分视图的代码

<div style="height: 400px;overflow-y: scroll">
    <div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;">
    <input type="text" class="form-control" id="Name" , placeholder="Enter First and Last Name " />
    </div>
    <div class="form-group" style="text-align:center;padding-bottom: 20px; padding-top: 10px;">
   <input type="text" class="form-control" id="sex" , placeholder="Sex" />
</div>

I call modal in main View like this 我这样称呼主视图中的模态

<div class="modal fade" id="addPatient" style="z-index: 5" role="dialog" data-backdrop="false">
<div class="modal-dialog">
    <!-- Modal content-->
    <div class="modal-content">
        <div class="modal-body">
            <p style="font-size: 20px;">Appointment successfully created </p>
        </div>
        <div class="modal-footer">
            @Html.Partial("~/Views/PatientDatabase/AddingPatient.cshtml")
        </div>
    </div>

</div>

But my inputs displaying in one row. 但是我的输入显示在一行中。

Like this 像这样

Screen 屏幕

Where problem can be? 问题可能在哪里?

As I understood it must display not in one row. 据我了解,它不能显示在一行中。

Hope there is float : left in form-group class. 希望在表单组类中有float : left So add clear:both in those div's style attribute. 因此clear:both在这些div的style属性中clear:both添加clear:both

<div style="height: 400px;overflow-y: scroll">
    <div class="form-group" style="clear:both;text-align:center;padding-bottom: 20px; padding-top: 10px;">
    <input type="text" class="form-control" id="Name" , placeholder="Enter First and Last Name " />
    </div>
    <div class="form-group" style="clear:both;text-align:center;padding-bottom: 20px; padding-top: 10px;">
   <input type="text" class="form-control" id="sex" , placeholder="Sex" />
   </div>
</div>

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

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