在我的项目中 使用GridMvc.Html创建模态对话框。显示对话框后,单击下一页模态是可见的错误,如果我单击也是模态的标题是可见的错误。 为什么在模式中使用gridmvc.html时无法进行排序和分页。
我的代码
模式(局部视图)
@model SCM_MVC.Models.Search
<link href="~/Content/Gridmvc.css" rel="stylesheet" />
<script src="~/Scripts/gridmvc.min.js"></script>
<div id="stkcorrectionsearch" class="modal fade" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="border-radius: 0.3rem;">
@Html.Label("General Search", new { @class = "model-title" })
<button type="button" id="btnclose" class="close" data-dismiss="modal">x</button>
</div>
<div class="card-body" style="margin:2%">
<div class="card-header">
@Html.Label("Search Details", new { @class = "card-title" })
</div>
<div class="row" style="margin-top:1%;">
<div class="col-sm-2">
@Html.LabelFor(m => m.Search_Field, new { @class = "control-label form-control-sm" })
</div>
<div class="col-sm-4">
@Html.DropDownListFor(m => m.Search_Field, ((List<SelectListItem>)ViewBag.Search).Select(m => new SelectListItem { Text = m.Text, Value = m.Value })
, new { @class = "form-control form-control-sm",@id= "cmbStkCorrectionField" })
</div>
<div class="col-sm-2">
@Html.LabelFor(m => m.Search_Value, new { @class = "control-label form-control-sm" })
</div>
<div class="col-sm-4">
@Html.TextBoxFor(m => m.Search_Value, new { @class = "form-control form-control-sm", @id = "txtStkCorrectionValue" })
</div>
</div>
<div class="col-sm-12 text-center" style="margin-top:2%;">
<button type="button" id="btnStkCorrectionSearch" class="btn btn-success" style="width:100px"><i class="fas fa-search"></i> Search</button>
</div>
<div id="stkcorrectiongrid" class="col-sm-12 table-responsive" style="width:100%;height:300px;margin-top:3%;padding-left:0px;padding-right:0px;">
@{Html.Partial("StkCorrectionGrid", new List<SCM_MVC.Models.Search>(), new ViewDataDictionary(this.ViewData) { { "xForm", ViewData["FormName"] } }); }
</div>
<div class="form-actions" style="margin-top:2%;padding-left:2%;">
<button type="button" class="btn btn-success btn-sm" id="btnStkCorrectionok" style="width:100px" data-dismiss="modal"><i class="fas fa-check"></i> OK </button>
</div>
</div>
</div>
</div>
</div>
<script src="~/SCM/assest/jquery/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function () {
var xScreen = '@ViewData["FormName"]';
xScreen = RemoveSpace(xScreen);
$('#stkcorrectiongrid').load('/Search/StkCorrectionGrid?xaction=Create&xValue=&xForm=' + xScreen);
});
$('#btnStkCorrectionSearch').on("click", function (e) {
var xSearchValue = "";
var xScreen = '@ViewData["FormName"]';
xScreen = RemoveSpace(xScreen);
if ($('#txtStkCorrectionValue').val() != "") {
xSearchValue = " and " + $('#cmbStkCorrectionField').val() + "=%27" + $('#txtStkCorrectionValue').val() + "%27";
xSearchValue = RemoveSpace(xSearchValue);
}
$('#stkcorrectiongrid').load('/Search/StkCorrectionGrid?xaction=Search&xValue=' + xSearchValue + '&xForm=' + xScreen );
})
</script>
GridMVC.Html(部分视图)
@model IEnumerable<SCM_MVC.Models.Search>
@using GridMvc.Html
@{
if (Model != null)
{
<div class="table-responsive">
@Html.Grid(Model).Columns(columns =>
{
columns.Add()
.Encoded(false)
.Sanitized(false)
.SetWidth(10)
.RenderValueAs(o => new HtmlString
(
"<input id='hiddenValue' type='hidden' class='check' value='" + o.select + "'/>" +
"<input type='checkbox' class='check' value=" + o.select + "/>"
));
columns.Add(c => c.stock_correction_no).Titled(Resources.Resource.stock_correction_no);
columns.Add(c => c.warehouse_no).Titled(Resources.Resource.warehouse_no);
}).WithPaging(10).Sortable(true).EmptyText("No data found").Named("GridSearch")
</div>
}
else
{
<label>No Data Found</label>
}
}
<style>
.grid-header a {
color: white;
}
</style>
查看
@model SCM_MVC.Models.StockCorrectionMdl
@{
ViewBag.Title = "EditStockCorrection";
Layout = "~/Views/Shared/MainPage.cshtml";
}
<script src="~/SCM/assest/jquery/jquery-3.2.1.min.js"></script>
@{ Html.RenderAction("StkCorrectionSearch", "Search");}
<div class="card">
<div class="card-header text-center" style="font-size:large">
@Html.Label(Resources.Resource.edit_stock_correction, new { @style = "font-size:larger;Font-Bold=true;" })
</div>
<div class="card" style="background-color:white;width:97%;margin-left:1.5%">
<div class="card-body" style="margin-top:1%;">
<div class="card-header">
@Html.Label(Resources.Resource.stock_correction_details, new { @class = "card-title" })
</div>
<div class="card-body" style="margin-top:1%;">
<div class="row" style="margin-top:1%">
<div class="col-sm-2">
@Html.LabelFor(m => m.stock_correction_no, new { @class = "control-label form-control-sm" })
</div>
<div class="form-group col-sm-3">
<div class="input-group input-group-sm">
@Html.TextBoxFor(m => m.stock_correction_no, new { @class = "form-control form-control-sm", @id = "txtstockCorrno" })
<span class="input-group-btn">
<button class="btn btn-sm btn-success" style="box-shadow:none;" data-toggle="modal" data-target="#stkcorrectionsearch"><i class="fa fa-search"></i></button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我正在使用VS 2017 MVC