【问题标题】:Close popup window after inserting data and refreshing datagrid with new data插入数据并用新数据刷新数据网格后关闭弹出窗口
【发布时间】:2012-07-15 17:23:56
【问题描述】:

我正在使用 asp.net。我有一个主页和一个弹出窗口。当我单击按钮时,将出现弹出窗口。弹出窗口包含两个文本字段和两个按钮。一个是提交数据的提交按钮(),另一个是关闭弹窗的简单输入型按钮。

当我单击取消按钮时,它会关闭弹出窗口。但是当我在文本框中填写信息并单击提交时,它会在服务器中插入数据,但弹出窗口没有关闭。我无法正确查看页面。数据网格正确刷新,但我无法在页面上执行操作。为此,我必须手动刷新页面。

请告诉我在将数据插入数据库后如何关闭asp.net中的弹出窗口。

这是显示和隐藏弹出窗口的代码:

<script language="javascript" type="text/javascript" src="../JS/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="../JS/modalpopup.js"></script>
<style>
  *html #dvPopup {
    top: expression(eval(document.documentElement.scrollTop)) !important;
  }
</style>
<table style="background-color: transparent" cellspacing="0" cellpadding="0" width="100%">
  <tr>
    <td class="heder" valign="middle" height="30" style="padding-left: 10px" colspan="2">
      <img height="13" hspace="5" src="../images/arrow.gif" width="13" align="absMiddle">
      &nbsp;<strong>Destination Management</strong>&nbsp;<br />
    </td>
  </tr>
  <tr>
    <td>Destination Name :
      <asp:TextBox ID="txtDestinationName" runat="server"></asp:TextBox>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
        ErrorMessage="*" ControlToValidate="txtDestinationName">
      </asp:RequiredFieldValidator>
    </td>
    <td>
      <asp:Button ID="btnAdd" runat="server" CssClass="BUTTON" Text="Add"
        Width="70px" OnClick="btnAdd_Click" >
      </asp:Button>&nbsp;
      <input type="button" id="Button1" value="Close"
        onclick="HideModalPopup('dvPopup'); return false;" />
    </td>
  </tr>
</table>

提前致谢。

【问题讨论】:

    标签: c# javascript asp.net


    【解决方案1】:

    在您的服务器端的事件点击处理程序中非常简单,

    HideModalPopup('dvPopup'); 的脚本资源添加到您的页面。

    this 应该对你有用

    【讨论】:

      【解决方案2】:

      提交后弹出窗口没有关闭,因为您没有在提交按钮上调用它

      发布到服务器后您将调用它

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-04-29
        • 2012-07-09
        • 1970-01-01
        • 1970-01-01
        • 2012-12-31
        相关资源
        最近更新 更多