Reputation: 3874
Is it possible to have several buttons associated with a single modalpopupextender?
<asp:Button ID="btnPopup" runat="server" Text="PopUp" style = "display:none" />
<asp:Button ID="Button1" runat="server" CssClass="btn btn-primary" onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" CssClass="btn btn-primary" onclick="Button2_Click" />
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:ModalPopupExtender ID="mpe" runat="server" BackgroundCssClass="modalBackground" PopupControlID="pnlPopup" TargetControlID="btnPopup" />
<asp:Panel ID="pnlPopup" runat="server" CssClass="modalPopup" Style="display: none">
// I will have updatepanel where content will change based on which button is clicked
</asp:Panel>
In code behind
protected void Button1_Click(object sender, EventArgs e)
{
mpe.TargetControlID = "Button1";
}
protected void Button2_Click(object sender, EventArgs e)
{
mpe.TargetControlID = "Button2";
}
Upvotes: 0
Views: 50
Reputation: 896
No, you can not associate multiple buttons with a single ModalPopupExtender, because it has only one target control.
However, you can point to a single popup control using PopupControlID attribute.
Upvotes: 1