C# &引用;此页面上的另一个对象已使用ID';XXXXXXX和x27;
与以下事项无关: 我的页面上有一个jQuery MultiselectC# &引用;此页面上的另一个对象已使用ID';XXXXXXX和x27;,c#,jquery,asp.net,jquery-multiselect,C#,Jquery,Asp.net,Jquery Multiselect,与以下事项无关: 我的页面上有一个jQuery MultiselectListbox控件: jQuery(document).ready(function () { jQuery(function () { jQuery("#UCStyle1 select").multiselect({ header: true, height: 175, minWidth: 240,
Listbox
控件:
jQuery(document).ready(function () {
jQuery(function () {
jQuery("#UCStyle1 select").multiselect({
header: true,
height: 175,
minWidth: 240,
size: 3,
classes: '',
checkAllText: 'Check all',
uncheckAllText: 'Uncheck all',
noneSelectedText: '0 Selected',
selectedText: '# selected',
selectedList: 0,
show: null,
hide: null,
autoOpen: false,
multiple: true,
position: {},
appendTo: "body"
});
});
它在div标记中引用了很多次,如下所示:
<tr>
<td>
Looking for:
</td>
<td colspan="3">
<div id="UCStyle1">
<asp:ListBox ID="MatchGender" SelectionMode="Multiple" runat="server">
</asp:ListBox>
</div>
</td>
</tr>
<tr>
<td>
State:
</td>
<td colspan="3">
<div id="UCStyle1">
<asp:ListBox ID="sState" SelectionMode="Multiple" runat="server">
</asp:ListBox>
</div>
</td>
</tr>
寻找:
声明:
所以,它们需要引用jQuery,但它们是不同的控件
我得到了警告:
此页面上的另一个对象已使用ID“ucstyle1”
多次
你知道我怎样才能把它清理干净,这样我就不会收到警告了吗?我认为这会导致IE上的页面看起来完全不稳定,但Firefox似乎并不关心它。你有两个
div
标签,它们具有相同的id
(UCStyle1
),但是由于id
是唯一的,你不能在页面中使用重复的标签。如果要重复,可以使用而不是id
<div class="UCStyle1">
完美的可能复制品。你的编辑是关键;将#UCStyle更改为.UCStyle以及将id更改为类。谢谢
<div class="UCStyle1">
jQuery(".UCStyle1 select").multiselect({