I'm facing a strange (for me) problem using a ModalPopUpExtender.
When I show it everything is good, when I hide it and then I want to show it again it doesn't appear anymore unless I reload the page.
This is the (partial) code of the page:
So...in the "codebehind" (C#) I show the popup through "modalSelCorso.Show()" (by clicking on a button in the page), it appears (it's a gridview to select an item from the list):
1) if I click on an item, the popup is closed through "modalSelCorso.Hide()" in the "OnSelectedIndexChanged" event: if I click the button to show the popup again, it shows;
2) if I click on "btAnnSelCorso" (thus without selecting an item) the popup closes (modalSelCorso.Hide(), codebehind) but if I click on the button to show it again it never shows anymore, I have to reload the page and then it works
I show the popup through "modalSelCorso.Show()" (by clicking on a button in the page)
Is this button a LinkButton7 or some other button?
washburn_it
if I click on "btAnnSelCorso" (thus without selecting an item) the popup closes (modalSelCorso.Hide(), codebehind) but if I click on the button to show it again it never shows anymore, I have to reload the page and then it works
If it's some other button,I tested the code you posted, it works fine.
if I click on an item, the popup is closed through "modalSelCorso.Hide()" in the "OnSelectedIndexChanged" event: if I click the button to show the popup again, it shows
How do you select an item from the list? i need more code of aspx and aspx.cs to reproduce your problem.
Best regards,
sam
IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
Member
3 Points
20 Posts
Issue with ModalPopUpExtender
Sep 11, 2019 10:52 AM|washburn_it|LINK
Hi All,
I'm facing a strange (for me) problem using a ModalPopUpExtender.
When I show it everything is good, when I hide it and then I want to show it again it doesn't appear anymore unless I reload the page.
This is the (partial) code of the page:
So...in the "codebehind" (C#) I show the popup through "modalSelCorso.Show()" (by clicking on a button in the page), it appears (it's a gridview to select an item from the list):
1) if I click on an item, the popup is closed through "modalSelCorso.Hide()" in the "OnSelectedIndexChanged" event: if I click the button to show the popup again, it shows;
2) if I click on "btAnnSelCorso" (thus without selecting an item) the popup closes (modalSelCorso.Hide(), codebehind) but if I click on the button to show it again it never shows anymore, I have to reload the page and then it works
What am I doing wrong?
Thank you, regards.
Roberto
Contributor
3370 Points
1409 Posts
Re: Issue with ModalPopUpExtender
Sep 12, 2019 03:04 AM|samwu|LINK
Hi washburn_it,
Is this button a LinkButton7 or some other button?
If it's some other button,I tested the code you posted, it works fine.
The code:
<cc1:ModalPopupExtender ID="modalSelCorso" runat="server" PopupControlID="pnlSelCorso" TargetControlID="LinkButton7" BehaviorID="modalSelCorso" BackgroundCssClass="modalBackground"> </cc1:ModalPopupExtender> <asp:LinkButton ID="LinkButton7" runat="server"></asp:LinkButton> <asp:Panel ID="pnlSelCorso" runat="server" CssClass="modalPopup" Style="display: none" > <div style="overflow-y: auto; overflow-x: hidden;"> <div class="modal-header light-blue darken-3 white-text"> <asp:Label ID="Label19" runat="server" CssClass="modal-title" Text="Seleziona Corso"></asp:Label> </div> <div class="modal-body"> <div class="form-group"> <asp:UpdatePanel ID="updSelCorso" runat="server" UpdateMode="Conditional"> <ContentTemplate> <div class="table-responsive"> <asp:GridView ID="gvSelCorso" runat="server" AllowPaging="True" DataKeyNames = "ID" ShowHeader="false" AutoGenerateColumns="False" CellPadding="0" Font-Names="Calibri" Height="0px" PageSize="15" align="center" CssClass="table table-striped table-bordered table-hover" OnRowCreated="gvSelCorso_RowCreated" OnPageIndexChanging="gvSelCorso_PageIndexChanging" OnSelectedIndexChanged="gvSelCorso_SelectedIndexChanged"> <Columns> <asp:BoundField DataField="codice" HeaderText="Codice Corso"/> <asp:BoundField DataField="descr" HeaderText="Descrizione"/> <asp:BoundField DataField="ID" Visible="False"/> </Columns> <FooterStyle Height="20%" BackColor="#99CCCC" ForeColor="#003399" /> <HeaderStyle BackColor="#0088CC" Font-Bold="True" ForeColor="#FFFFFF" /> <PagerStyle CssClass="gridview"/> <RowStyle Height="40px" BackColor="White" ForeColor="#003399" Wrap="False"/> <SelectedRowStyle BackColor="LightBlue" BorderStyle="Solid" Font-Bold="True" ForeColor="White" /> </asp:GridView> </div> </ContentTemplate> </asp:UpdatePanel> </div> <div class="modal-footer"> <div class="row" style="margin-left: auto; margin-right: auto;"> <div class="col-md-12"> <button id="btAnnSelCorso" runat="server" class="btn btn-danger" title="chiude il popup" onserverclick="btAnnSelCorso_Click">Annulla</button> </div> </div> </div> </div> </div> </asp:Panel> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> protected void btAnnSelCorso_ServerClick(object sender, EventArgs e) { modalSelCorso.Hide(); } protected void Button1_Click(object sender, EventArgs e) { modalSelCorso.Show(); }
The result:
How do you select an item from the list? i need more code of aspx and aspx.cs to reproduce your problem.
Best regards,
sam