I have a web page which has multiple modal popup windows. The popup is being triggered from a codebehind page based on a button click event. The code behind reads from the form dropdown and depending on which item is selected in the dropdown a different modal window is supposed to display. When running in the debugger, I can see that the correct modal is called either CompleteEventPopupExtender.Show(); or CancelEventCommmentPopupExtender.Show(); but the same panel displays for both of these. the one that displays is the panel that is written 1st in the .aspx page. Each modal is in its own panel with its own names. I have tried adding div tags to the panels, updatePanel to the panels, but nothing seems to be working.
Here is the code for the .aspx page:
<tr><td><asp:Label ID="StatusLabel" runat="server"></asp:Label><asp:DropDownList ID="StatusDropdown" runat="server" AutoPostBack="true" DataSourceID="EventStatusDataSource" DataTextField="Name" DataValueField="ID" OnSelectedIndexChanged="StatusDropDownList_SelectedIndexChanged" /><asp:Panel ID="CancelEventCommentPanel" runat="server" ScrollBars="Auto" Style="display: none;
border: solid 1px gray; padding: 20px; background-color: #FDF0DD; margin: 0px;
width: 300px; height: 250px;"><asp:UpdatePanel ID="CancelEventUpdatePanel" runat="server" UpdateMode="Conditional"><ContentTemplate><table><tr><td align="left"><asp:Image ID="Image2" runat="server" ImageUrl="~/Images/error.png" />
Please enter a comment explaining why the event has been Cancelled.<asp:RequiredFieldValidator ID="CancelledCommentRequiredFieldValidator" runat="server" ControlToValidate="CancelCommentTextBox" ErrorMessage="* You must enter a comment" ValidationGroup="CancelCommentValidationGroup"></asp:RequiredFieldValidator><textarea id="CancelCommentTextBox" runat="server" cols="75" onchange="javascript:setCharsRemainingCancelledComment(this)" onkeyup="javascript:setCharsRemainingCancelledComment(this)" rows="5" style="width: 100%"></textarea> <span class="charsRemainingBox"><asp:TextBox ID="CancelCommentCounter" runat="server" Columns="5" ReadOnly="True" TabIndex="500"></asp:TextBox> Characters Remaining </span><br /><br /><asp:Button ID="ConfirmCancelAction_Button" runat="server" CausesValidation="true" OnCommand="SaveEvent_Click" Text="OK" ValidationGroup="CancelCommentValidationGroup" /><asp:Button ID="Button1" runat="server" CausesValidation="false" Text="Cancel" /></td></tr></table></ContentTemplate></asp:UpdatePanel></asp:Panel><cc1:ModalPopupExtender ID="CancelEventCommmentPopupExtender" runat="server" BackgroundCssClass="modalBackground" PopupControlID="CancelEventCommentPanel" PopupDragHandleControlID="labeldrag" TargetControlID="LinkButton2"></cc1:ModalPopupExtender><asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="false"></asp:LinkButton><asp:Panel ID="CompleteEventPanel" runat="server" ScrollBars="Auto" Style="display: none;
border: solid 1px gray; padding: 20px; background-color: #FDF0DD; margin: 0px;
width: 300px; height: 250px;"><asp:UpdatePanel ID="CompleteEventUpdatePanel" runat="server" UpdateMode="Conditional"><ContentTemplate><table><tr><td align="left"><asp:Image ID="Image3" runat="server" ImageUrl="~/Images/error.png" />
After the event has been completed, you will no longer be able to make changes.<br />
Do you want to continue?<br /><br /><asp:Button ID="ConfirmCompleteEvent" runat="server" CausesValidation="false" OnCommand="SaveEvent_Click" Text="OK" /><asp:Button ID="Button3" runat="server" CausesValidation="false" Text="Cancel" /></td></tr></table></ContentTemplate></asp:UpdatePanel></asp:Panel><cc1:ModalPopupExtender ID="CompleteEventPopupExtender" runat="server" BackgroundCssClass="modalBackground" PopupControlID="CompleteEventPanel" PopupDragHandleControlID="labeldrag" TargetControlID="LinkButton3"></cc1:ModalPopupExtender><asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="false"></asp:LinkButton></td></tr>Here is the code behind page:
protected void SaveEvent_Click(object sender, EventArgs e)
{
// Get the selected EventStatus from the Status dropdown menu
EventStatus selectedStatus =
EventManager.resolveEventStatus(Convert.ToInt32(StatusDropdown.SelectedValue));
bool statusChangedToCancelled = false;
bool statusChangedToCompleted = false;
if (selectedStatus == EventStatus.Cancelled || selectedStatus == EventStatus.Completed)
{
EventInformation info = new EventInformation(EventID);
EventStatus previousStatus = EventManager.resolveEventStatus(info.EventStatusID);
if (previousStatus != EventStatus.Cancelled)
{
statusChangedToCancelled = true;
}
else if (previousStatus != EventStatus.Completed)
{
statusChangedToCompleted = true;
}
}
// If the state has changed to "Cancelled", prompt the user to submit a comment
if (statusChangedToCancelled &&
string.IsNullOrEmpty(CancelCommentTextBox.Value))
{
// Prompt the user to submit a comment
CancelEventCommmentPopupExtender.Show();
}
// If the state has changed to "Completed", prompt the user to continue
else if (statusChangedToCompleted)
{
// Prompt the user to submit a comment
CompleteEventPopupExtender.Show();
}
What am I doing wrong?
Thanks in advance!