ユーザーがビュー内の人物名の上を移動したときに、部分ビューで表示されるデータでモーダルを表示しようとしています。私はモーダルを表示することができますが、データはなく、ビューに表示される名前はlinq文によって生成されるので、divはすべて同じクラス指定を持っています。これにより、ページ上のすべての名前にモデルが表示されます。私はこれらの問題をどのように克服するかについてはわかりません。ここでモーダルで部分的に表示してデータを表示しない
は、私がこれまでに...
jQueryのモーダル
$(document).ready(function (data) {
$('accountNumber').hover(function() {
var id = $(this).data("personID")
$(".modal").dialog({
autoOpen: true,
position: { my: "center", at: "center", of: parent },
width: 300,
resizable: false,
title: 'Accounts Information',
modal: true,
open: function() {
$(this).load('@Url.Action("_AccountNumberModal", "ICMS", ' + id + ')');
},
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
return false;
});
});
コントローラのアクション部分図のため
public ActionResult _AccountNumberModal(SearchViewModel viewModel, string id)
{
tblPeople people = db.tblPeoples.FirstOrDefault(x => x.PeopleCounterID.ToString() == id);
{
viewModel.FirstName = people.FirstName;
viewModel.LastName = people.LastName;
viewModel.AccountNumber = people.AccountNumber;
viewModel.AccountNumber2 = people.AccountNumber2;
viewModel.AccountNumber3 = people.AccountNumber3;
viewModel.AccountNumber4 = people.AccountNumber4;
viewModel.AccountClosed = people.AccountClosed;
viewModel.AccountClosed2 = people.AccountClosed2;
viewModel.AccountClosed3 = people.AccountClosed3;
viewModel.AccountClosed4 = people.AccountClosed4;
viewModel.AccountClosedDate1 = people.AccountClosedDate1;
viewModel.AccountClosedDate2 = people.AccountClosedDate2;
viewModel.AccountClosedDate3 = people.AccountClosedDate3;
viewModel.AccountClosedDate4 = people.AccountClosedDate4;
viewModel.TypeofAccount1 = people.TypeofAccount1;
viewModel.TypeofAccount2 = people.TypeofAccount2;
viewModel.TypeofAccount3 = people.TypeofAccount3;
viewModel.TypeofAccount4 = people.TypeofAccount4;
}
return View(viewModel);
}
を作成し、移入したものです部分図
@model FHN.EIR.Web.Models.SearchViewModel
<section id="accountNumbers" class="sectionHeadingBold">Account Information</section>
@if (!string.IsNullOrEmpty(Model.AccountNumber))
{
<dl class="inline dl-rows">
<dt>
@Html.DisplayNameFor(model => model.AccountNumber)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountNumber)
</dd>
<dt>
@Html.DisplayNameFor(model => model.TypeofAccount1)
</dt>
<dd class="width-275px">
@Html.DisplayFor(model => model.TypeofAccount1)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AccountClosed)
</dt>
<dd class="width-dateField">
@if (Model.AccountClosed)
{
@Html.DisplayName("Closed")
}
else
{
@Html.DisplayName("Open")
}
</dd>
@if (Model.AccountClosed)
{
<dt>
@Html.DisplayNameFor(model => model.AccountClosedDate1)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountClosedDate1)
</dd>
}
</dl>
<br />
if (!String.IsNullOrEmpty(Model.AccountNumber2))
{
<dl class="inline dl-rows">
<dt>
@Html.DisplayNameFor(model => model.AccountNumber2)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountNumber2)
</dd>
<dt>
@Html.DisplayNameFor(model => model.TypeofAccount2)
</dt>
<dd class="width-250px">
@Html.DisplayFor(model => model.TypeofAccount2)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AccountClosed2)
</dt>
<dd class="width-dateField">
@if (Model.AccountClosed2)
{
@Html.DisplayName("Closed")
}
else
{
@Html.DisplayName("Open")
}
</dd>
@if (Model.AccountClosed2)
{
<dt>
@Html.DisplayNameFor(model => model.AccountClosedDate2)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountClosedDate2)
</dd>
}
</dl>
<br />
}
if (!String.IsNullOrEmpty(Model.AccountNumber3))
{
<dl class="inline dl-rows">
<dt>
@Html.DisplayNameFor(model => model.AccountNumber3)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountNumber3)
</dd>
<dt>
@Html.DisplayNameFor(model => model.TypeofAccount3)
</dt>
<dd class="width-250px">
@Html.DisplayFor(model => model.TypeofAccount3)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AccountClosed3)
</dt>
<dd class="width-dateField">
@if (Model.AccountClosed3)
{
@Html.DisplayName("Closed")
}
else
{
@Html.DisplayName("Open")
}
</dd>
@if (Model.AccountClosed3)
{
<dt>
@Html.DisplayNameFor(model => model.AccountClosedDate3)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountClosedDate3)
</dd>
}
</dl>
<br />
}
if (!String.IsNullOrEmpty(Model.AccountNumber4))
{
<dl class="inline dl-rows">
<dt>
@Html.DisplayNameFor(model => model.AccountNumber4)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountNumber4)
</dd>
<dt>
@Html.DisplayNameFor(model => model.TypeofAccount4)
</dt>
<dd class="width-250px">
@Html.DisplayFor(model => model.TypeofAccount4)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AccountClosed4)
</dt>
<dd class="width-dateField">
@if (Model.AccountClosed4)
{
@Html.DisplayName("Closed")
}
else
{
@Html.DisplayName("Open")
}
</dd>
@if (Model.AccountClosed4)
{
<dt>
@Html.DisplayNameFor(model => model.AccountClosedDate4)
</dt>
<dd>
@Html.DisplayFor(model => model.AccountClosedDate4)
</dd>
}
</dl>
}
}
else
{
<dl class="inline dl-rows">
<dt>
<span class="mar-l-15px inline-messages">There are no accounts associated with this person</span>
</dt>
</dl>
}
UPDATE
私は、データを取り込むために取得することができました。名前をつけただけで関連するモーダルが開かれ、すべての名前がモーダルになるようにする方法を確かめないでください。