我有一个数据库表 Prospect
,它存储具有主键 ID 和版本的潜在客户。网络表单中有一个单选按钮 Generate Proposal
,单击该按钮时应显示一个对话框,允许用户从下拉框中选择要生成的潜在客户版本。我有一种方法可以从数据库中检索潜在客户 GetVersions()
的版本,但不知道如何将其放入对话框中以允许用户选择版本。任何帮助是极大的赞赏。
最佳答案
JQuery UI 会是一个选项吗?
您必须添加可以找到的 JQuery UI 引用 Here
Here is the documentation on the JQuery UI dialog.
以下代码摘 self 实现的解决方案。为了简单起见,我删除了很多代码。如果您需要任何说明,请告诉我。
HTML:
<div id="MenuChangeSelection" title="Change Selection" class="MainDialog">
<div id="MenuChangeSelectionContent"></div>
</div>
JQuery:
$("#YourRadBtnID").click(function () {
var yourDropDownMarkup = "<select><option value='Opt1'>Opt1</option></select>"; // Insert your dropdown markup or get your dropdown from the dom.
$("#MenuChangeSelectionContent").html(yourDropDownMarkup);
$("#MenuChangeSelection").dialog({
autoOpen: true,
modal: true,
width: 600,
height: 150,
buttons: {
"Save And Close": function() {
//Do something when Save And Close is clicked. eg. asynchronously post back to server.
},
"Cancel": function() {
$(this).dialog("close");
}
},
open: function () {
$('.ui-widget-overlay').addClass('custom-overlay');
},
close: function () {
$('.ui-widget-overlay').removeClass('custom-overlay');
}
});
});
CSS:
.ui-widget-overlay.custom-overlay
{
background-color:black;
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
}
关于c# - 带有从数据库检索的选项的对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40540424/