显示弹出窗口

时间:2016-04-20 06:52:59

标签: c# asp.net

我选择了“新建”选项。     当用户在下拉列表中单击“新建”时,我需要显示弹出窗口,然后显示弹出窗口。

 function ShowPopup()
 {

    var a = document.getElementById('<%= DropDownConfigFile.ClientID %>').selectedIndex;          
    var b = document.getElementById('<%= DropDownConfigFile.ClientID %>').options[a].value;         

    // window.ShowPopup("ModalPop.aspx");
    window.open("ModalPop.aspx", "List");

我在这里调用此函数,

 <asp:DropDownList ID="DropDownConfigFile" runat="server" CssClass="selectpicker" onchange = "ShowPopup()">

但弹出窗口正在另一个窗口中显示。不在同一个窗口。     这段代码有任何错误。

2 个答案:

答案 0 :(得分:0)

我认为你在寻找

Jquery Dialog

并参考

Window.open

答案 1 :(得分:0)

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap </title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
  <h2>Modal Popup Using Bootstrap</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
    
      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>Some text in the modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
      
    </div>
  </div>
  
</div>

</body>
</html>