Microsoft Developer
Microsoft Developer

Reputation: 5459

Open single pop up from two different buttons

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"  />
      &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>

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.???

Upvotes: 1

Views: 1635

Answers (2)

Junaid
Junaid

Reputation: 1755

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.

Upvotes: 0

Muhammad Irfan
Muhammad Irfan

Reputation: 131

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

Upvotes: 2

Related Questions