【发布时间】:2011-06-08 12:55:18
【问题描述】:
StackOverflow 上有几篇关于这个主题的帖子,但没有一个答案对我有帮助。 我正在使用由 SELECT 通过 DataAdapter 填充的 DataList 控件。 一个概念,建议只打开一个对话框实例,但不能应用此方法
html的结构是:
<asp:DataList ID="DataList" runat="server">
<ItemStyle />
<ItemTemplate>
<a href="" class="link"/></a>
<div class = "dialog" id="dynamicID" style="display:none">
</ div>
</ ItemTemplate>
</ asp: DataList>
我使用的 jQuery 代码是:
<script language="javascript" type="text/javascript">
$ (function () {
$ (". link. ") click (function () {
var id = '#' + ($ (this). siblings ('. dialog'). attr ('id'));
$ (id). dialog ({
AutoOpen: false,
closeOnEscape: true,
resizable: false,
draggable: false,
modal: true,
width: 800,
height: 600,
overlay: {backgroundColor: "# 000", opacity: 0.5},
top: 20,
show: 'fade',
hide: 'fade',
buttons: {
"Close": function () {
$ (id). dialog ('close');
}
}
});
$ (id). dialog ('open');
});
});
</ script>
【问题讨论】:
标签: jquery-ui modal-dialog jquery-ui-dialog