modalpopupextender.Show() wont fire
Posted
by
Peter Lea
on Stack Overflow
See other posts from Stack Overflow
or by Peter Lea
Published on 2012-07-04T21:11:53Z
Indexed on
2012/07/04
21:15 UTC
Read the original article
Hit count: 251
I'm pretty new to developing for the web so bare with me. I have a company page with multiple locations and emails etc at each of these addresses. The idea is to have a single modalpopup to edit each type of data (one for email, one for urls, one for addresses etc).
I link the modalpopupextender to a hiddenbutton and then call an edit function from various places where I can populate some hiddenfields and textboxes in the panel before showing it. The code executes but it just wont show the damn popup, I just see a flash and can't figure out if its my panel, my css or something I don't understand about ajax and postbacks etc.
Things i've tried after reading various threads:
- Disable smart navigation in web.config
- Move ToolKitScriptManager up to master page and use proxy in content
- set hiddenbutton to use style="display:none"
- tried links etc instead of hidden button
Heres my code
CSS
.modalBackground
{
position: absolute;
z-index: 100;
top: 0px;
left: 0px;
background-color: #000;
filter: alpha(opacity=60);
-moz-opacity: 0.6;
opacity: 0.6;
}
.modalPopup {
background-color: #FFD;
border-width: 3px;
border-style: solid;
border-color: gray;
padding: 3px;}
Asp/html
<ajaxToolkit:ModalPopupExtender runat="server" ID="mpe_email" BackgroundCssClass="modalBackground" PopupControlID="modal_email" CancelControlID="btn_cancel_email" TargetControlID="fake_btn_email" />
<asp:Button ID="fake_btn_email" runat="server" Text="email" style="display:none;" />
<asp:panel id="modal_email" runat="server" class="modalPopup" Width="500px" Height="500px">
<asp:HiddenField ID="hf_modal_email_location_id" runat="server" Value="" />
<asp:HiddenField ID="hf_modal_email_contact_id" runat="server" Value="" />
<asp:HiddenField ID="hf_modal_email_comms_id" runat="server" Value="" />
<table width="100%">
<tr>
<td>
<asp:Label ID="lbl_mpe_email_title" runat="server" Text="Edit Email Address" />
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="40px"><img src="../images/email.png" height="30px" width="30px"/></td>
<td>
<table width="100px">
<tr>
<td><span>Quick Ref: <asp:TextBox ID="txb_mpe_email_qref" runat="server" Text="" /></span></td>
</tr>
<tr>
<td><span>Email Address: <asp:TextBox ID="txb_mpe_email_address_full" runat="server" Text="" /></span></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="40px" align="left"><asp:Button ID="btn_cancel_email" runat="server" Text="Cancel"/></td>
<td align="right"><asp:Button ID="btn_save_email" runat="server" Text="Save" OnCommand="save_modal_email" /></td>
</tr>
<tr>
<td colspan="2" align="right"><asp:Label ID="lbl_mpe_email_err" runat="server" Text="" /></td>
</tr>
</table>
c#
public void oloc_ocon_email_edit(object sender, RepeaterCommandEventArgs e)
{
switch (e.CommandName)
{
case "edit":
hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id")).Value;
hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id")).Value;
hf_modal_email_comms_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_comms_id")).Value;
lbl_mpe_email_title.Text = "Edit Email Address";
txb_mpe_email_qref.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_qref")).Value;
txb_mpe_email_address_full.Text = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_email_full")).Value;
lbl_mpe_email_err.Text = "";
mpe_email.Show();
break;
case "new":
hf_modal_email_location_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_location_id_p")).Value;
hf_modal_email_contact_id.Value = ((HiddenField)e.Item.FindControl("hf_oloc_ocon_emails_contact_id_p")).Value;
hf_modal_email_comms_id.Value = "0";
lbl_mpe_email_title.Text = "New Email Address";
txb_mpe_email_qref.Text = "";
txb_mpe_email_address_full.Text = "";
lbl_mpe_email_err.Text = "";
mpe_email.Show();
break;
}
}
Stuff makes so much more sense in a desktop environment, I hope someone can point me in the right direction. Thanks
© Stack Overflow or respective owner