0
我有局部视图:道场不MVC局部视图工作
<div id="[email protected](ViewData["UniqueId"])" class="agreement-box">
<span>
I read agreement
</span>
<a>
terms of usage
</a>
</div>
<script>
require([
'dojo/dom',
"dijit/form/CheckBox",
"dojo/dom-construct",
"dojo/ready"],
function ([email protected](ViewData["UniqueId"]), [email protected](ViewData["UniqueId"]), [email protected](ViewData["UniqueId"]), [email protected](ViewData["UniqueId"])) {
[email protected](ViewData["UniqueId"])(function() {
[email protected](ViewData["UniqueId"]).placeAt([email protected](ViewData["UniqueId"]).byId("[email protected](ViewData["UniqueId"])"), "first");
});
var [email protected](ViewData["UniqueId"]) = new [email protected](ViewData["UniqueId"])(
{
id: "[email protected](ViewData["UniqueId"])",
name: "[email protected](ViewData["UniqueId"])",
class: "i-agree-checkbox",
checked: false
});
});
</script>
我利用一切形式下,这种观点(每个表单有一个唯一的ID女巫我作为ViewData的使用[“唯一ID”]) :
@Html.Partial("../MyPartialView", new ViewDataDictionary { { "UniqueId", "Order" } })
当这个视图出现在每个页面上时,它会起作用,但是当它看起来更多时,这个复选框就不会出现在页面上。我没有得到任何错误,并在铬调试器的代码工作!
生成的输出:
<div id="AgreementBoxContact" class="agreement-box">
<span>
I read agreement
</span>
<a>
terms of usage
</a>
</div>
<script>
require([
'dojo/dom',
"dijit/form/CheckBox",
"dojo/dom-construct",
"dojo/ready"],
function (domContact, checkboxContact, constructContact, readyContact) {
readyContact(function() {
agreecheckboxContact.placeAt(domContact.byId("AgreementBoxContact"), "first");
});
var agreecheckboxContact = new checkboxContact(
{
id: "IAgreeToTermsOfUseContact",
name: "iagreetotermsofuseContact",
class: "i-agree-checkbox",
checked: false
});
});
</script>
//
//on the same html page
//
<div id="AgreementBoxOrder" class="agreement-box">
<span>
I read agreement
</span>
<a>
terms of usage
</a>
</div>
<script>
require([
'dojo/dom',
"dijit/form/CheckBox",
"dojo/dom-construct",
"dojo/ready"],
function (domOrder, checkboxOrder, constructOrder, readyOrder) {
readyOrder(function() {
agreecheckboxOrder.placeAt(domOrder.byId("AgreementBoxOrder"), "first");
});
var agreecheckboxOrder = new checkboxOrder(
{
id: "IAgreeToTermsOfUseOrder",
name: "iagreetotermsofuseOrder",
class: "i-agree-checkbox",
checked: false
});
});
</script>
请帮我看看,为什么它的发生!
尝试用'''dojo/domReady!'代替''dojo/ready''' – ben
我试过了,但是得到了同样的结果。 – levkaster
不确定要了解这是如何工作的。它是多个复选框下的一种形式或一个复选框跨多个表单? – ben