【发布时间】:2016-01-13 22:25:51
【问题描述】:
I have a dropdown list that when selected sets a bunch of variables in C#.然后使用这些变量填充弹出框,然后用户单击 DDL 旁边的锚点。这很好,但事实上,当我更改 DDL 中的值时,弹出框会保留旧数据。它从不使用新数据更新/刷新。
总之,用户点击下拉菜单来更改变量。 DDL 旁边有一个帮助图标,用户单击该图标可显示弹出框,其中的数据是从 DDL 设置的变量中检索的。
我假设它在页面加载时第一次使用对象数据时保留。我尝试过多次销毁、隐藏和重写,它只是保留旧数据。
问题:如何让弹出框接受新数据。
$( document ).ready( function (){
$( "#ShowMeterInfo" ).popover( {
title: '<h3 class="custom-title"><span class="glyphicon glyphicon-info-sign"></span> Meter: <%=this.HiddenMeterName.Value%></h3>',
content: "<p><ul><li><strong>Location:</strong><%=this.MeterLocation %></li><li><strong>Id:</strong> 321654</li><li><strong>Building:</strong><%=this.MeterBuilding%></li><li><strong>Site:</strong><%=this.MeterSite%></li></ul></p>",
template: '<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div><div class="popover-footer"><a href="#" class="btn btn-info btn-sm">Close</a></div></div>',
html: true,
animation: true
} );
$( document ).on( "click", ".popover-footer .btn", function (){
$( this ).parents( ".popover" ).popover( 'destroy' );
} );
});
除了数据不会刷新之外,它工作得很好!
【问题讨论】:
标签: jquery html asp.net popover