从两个不同的按钮打开单个弹出窗口

发布于 2024-12-16 22:06:09 字数 2751 浏览 3 评论 0原文

我有两个不同的按钮,即保存和更新。我想为两个按钮打开一个弹出窗口,那么我该怎么做呢?此外,如果弹出窗口在保存按钮单击时打开,那么当它关闭时,它应该定向到 OnClick_save() 按钮事件,如果它是从更新按钮打开的,在弹出窗口上,它应该定向到 OnClick_Update()按钮点击事件。

我该怎么办? 这是我的代码

<tr>
<td>
<table id="tblButton" runat="server">
   <tr>
       <td>
            <asp:Button ID="btnAdd" runat="server" Text="Add" Visible="false"  />
      &nbsp;<asp:Button ID="btnUpdate" runat="server" Text="Update" Visible="false" />&nbsp;<asp:Button ID="btnDelete" runat="server" Text="Delete" Visible="false" />
      &nbsp;<asp:Button ID="btnTargetButton" runat="server" Text="PopUpTarget" Visible="false" />
       </td>
   </tr>
 </table>
</td>
            </tr>
        </table>
    </td>
</tr>
<cc1:ModalPopupExtender ID="ModalPopupExtenderSave" runat="server"    TargetControlID="btnTargetButton" PopupControlID="passwordPopUp" DropShadow="true"   PopupDragHandleControlID="header" BackgroundCssClass="modalBackground" BehaviorID="ModalPopupExtenderSave" />

</table>
<asp:Panel ID="passwordPopUp" runat="server" Style="display: none; padding: 10px;
border: 1px; border-style: solid;" BackColor="#91C83B" Width="300px"   HorizontalAlign="Center"
BorderStyle="Solid" BorderWidth="5px">
<table class="TABLE100">
    <tr>
        <td colspan="3">
            <h3 style="text-align: center;" id="header">
                Confirm Password</h3>
        </td>
    </tr>
    <tr>
        <td colspan="3">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;
        </td>
        <td width="50px">
            <asp:Label ID="lblPasswrd" runat="server" Text="Password" Font-Bold="True" Font-Size="Larger"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtPassword" runat="server" SkinID="TextBoxLong"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;
        </td>
        <td>
            &nbsp;
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;
        </td>
        <td>
            &nbsp;
        </td>
        <td>
            <asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" Width="70px" OnClick="btnSubmit_Click"/>
        </td>
    </tr>
</table>
</asp:Panel>

我在一定程度上解决问题的一些方法。 现在的问题是三个不同的按钮,即。插入、更新和删除按钮负责打开弹出窗口,该窗口又打开一个 ASP:面板,该面板包含提交按钮。那么在提交按钮上,我能知道哪个按钮负责打开面板吗????

I have two different buttons viz save and update. I want to open single pop-up window for both buttons, then how can I do so.? More over if pop-up is open on save buttons click then when ever it is closed, it should directed to OnClick_save() button event and if it is open from update buttons, on pop-up colse, it should directed to OnClick_Update() buttons click event.

How can I do so??
This is my code

<tr>
<td>
<table id="tblButton" runat="server">
   <tr>
       <td>
            <asp:Button ID="btnAdd" runat="server" Text="Add" Visible="false"  />
       <asp:Button ID="btnUpdate" runat="server" Text="Update" Visible="false" /> <asp:Button ID="btnDelete" runat="server" Text="Delete" Visible="false" />
       <asp:Button ID="btnTargetButton" runat="server" Text="PopUpTarget" Visible="false" />
       </td>
   </tr>
 </table>
</td>
            </tr>
        </table>
    </td>
</tr>
<cc1:ModalPopupExtender ID="ModalPopupExtenderSave" runat="server"    TargetControlID="btnTargetButton" PopupControlID="passwordPopUp" DropShadow="true"   PopupDragHandleControlID="header" BackgroundCssClass="modalBackground" BehaviorID="ModalPopupExtenderSave" />

</table>
<asp:Panel ID="passwordPopUp" runat="server" Style="display: none; padding: 10px;
border: 1px; border-style: solid;" BackColor="#91C83B" Width="300px"   HorizontalAlign="Center"
BorderStyle="Solid" BorderWidth="5px">
<table class="TABLE100">
    <tr>
        <td colspan="3">
            <h3 style="text-align: center;" id="header">
                Confirm Password</h3>
        </td>
    </tr>
    <tr>
        <td colspan="3">
             
        </td>
    </tr>
    <tr>
        <td>
             
        </td>
        <td width="50px">
            <asp:Label ID="lblPasswrd" runat="server" Text="Password" Font-Bold="True" Font-Size="Larger"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtPassword" runat="server" SkinID="TextBoxLong"></asp:TextBox>
        </td>
    </tr>
    <tr>
        <td>
             
        </td>
        <td>
             
        </td>
        <td>
             
        </td>
    </tr>
    <tr>
        <td>
             
        </td>
        <td>
             
        </td>
        <td>
            <asp:Button ID="btnSubmit" runat="server" Text="SUBMIT" Width="70px" OnClick="btnSubmit_Click"/>
        </td>
    </tr>
</table>
</asp:Panel>

Some how I have solved the problem up to certain extent.
Now the problem is three different buttons viz. Insert, Update and delete buttons are responsible for opening pop-up window which in turn opens an ASP:panel the panel contains submit button. So on submit button, can I know which button was responsible for opening a panel.???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静待花开 2024-12-23 22:06:09

您可以使用隐藏按钮作为模式弹出窗口的Okbutton,然后从代码中调用按钮OnClick。通过“保存”和“更新”按钮。

You can use a hidden button as modal popup's Okbutton and call then button OnClick from code. from both Save and Updated buttons.

可可 2024-12-23 22:06:09

为每次按钮单击添加服务器端事件处理程序。使用 jquery 显示每个按钮的弹出窗口,即来自 jquery 的 $('#button1').click$('#button2').click

add server side event handlers for each button click. use jquery to show popup for each button, that would be $('#button1').click and $('#button2').click from jquery.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文