这里我有一个带有"新建"选项的下拉选项.当用户选择"新建"时,它应显示"模态弹出窗口".
这是下拉代码
<asp:DropDownList ID="DropDownConfigFile" runat="server" CssClass="selectpicker">
<asp:ListItem Text="Create New" Value="1" ></asp:ListItem>
</asp:DropDownList>
Run Code Online (Sandbox Code Playgroud)
这是打开弹出窗口的Jquery,
<script type="text/javascript">
$(function () {
//Attach click event to your Dropdownlist
$("#DropDownConfigFile").change(function () {
//Get the selected valu of dropdownlist
selection = $(this).val();
//If its one then show the dialog window. You can change this condition as per your need
if (selection == 1) {
//Show the modal window
$('#myModal').modal('show');
}
});
});
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的Modal弹出式设计.
<div id="myModal" class="modal fade">
<asp:Panel ID="Panel1" runat="server" align="center" style = "display:contents "> …Run Code Online (Sandbox Code Playgroud)