I have a place on my page where a user can select from a radiobuttonlist. The AutoPostBack = True for the list.
If the user makes a certain selection I display a Panel that allows them to choose something from a drop-down menu, and press "Select" which closes the popup.
However, there are other controls in my code that have AutoPostBack = "True" and if the RadioButton corresponding with the PopupExtender is still clicked it will display the ModalPopupExtender Panel again.
Does anyone know how I can work around this? Here is the markup code first, followed by the VB.Net code after.
Protected Sub radInqRel_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radInqRel.SelectedIndexChanged
If Request.QueryString("prog") = "Hill Center" And radInqRel.SelectedIndex = 0 Then
SubName.Text = InqName.Text
End If
If radInqRel.SelectedIndex = 3 And Not IsPostBack Then
ModalPopupExtender1.Show()
ElseIf radInqRel.SelectedIndex = 2 Then
MoreInfo.Visible = False
End If
End Sub
I thought that by adding the And Not IsPostBack would work, but it didnt. Any help would be appreciated. Thanks in Advance, NickG
Firstly I see you are missing the Selected IndexChcnged for the RadioButtonList. It is defined in the code behind but it is not associated with your RadioButtonList control..
That worked, also I didn't realize but I had functionality in the Page_Load, which wasn't checking if things were a postback. Thank you for your help, and helping me realize another thing to check on with the associations of the back-end code. I appreciate
it.
NickG21
Member
46 Points
42 Posts
ModalPopupExtender shows after AutoPostBack
Feb 16, 2012 06:03 PM|LINK
Hey everyone,
I have a place on my page where a user can select from a radiobuttonlist. The AutoPostBack = True for the list.
If the user makes a certain selection I display a Panel that allows them to choose something from a drop-down menu, and press "Select" which closes the popup.
However, there are other controls in my code that have AutoPostBack = "True" and if the RadioButton corresponding with the PopupExtender is still clicked it will display the ModalPopupExtender Panel again.
Does anyone know how I can work around this? Here is the markup code first, followed by the VB.Net code after.
<asp:Panel runat="server"> <asp:RadioButtonList ID="radInqRel" runat="server" RepeatColumns="2" Width="500px" CssClass="style66" AutoPostBack="True"> <asp:ListItem>a. Patient - Self</asp:ListItem> <asp:ListItem>b. Family / Friend</asp:ListItem> <asp:ListItem>c. Clinician, McLean</asp:ListItem> <asp:ListItem>d. Clinician, outside McLean</asp:ListItem> <asp:ListItem>e. Other (e.g. Court, lawyer)</asp:ListItem> </asp:RadioButtonList> <asp:HiddenField ID="HiddenField1" runat="server" /> </asp:Panel> <asp:Panel runat="server" ID="pnlSelDeg" Width="200px"> <span class="PopupTitle">Select Degree:</span><br /> <asp:DropDownList ID="ddClinDegree" runat="server"> <asp:ListItem>MD</asp:ListItem> <asp:ListItem>PhD</asp:ListItem> <asp:ListItem>LICSW</asp:ListItem> <asp:ListItem>Other</asp:ListItem> </asp:DropDownList><br /> <asp:Button runat="server" ID="btnSelDeg" Text="Select Degree" /> <p class="style68">Please Select Degree, page is inactive until degree is selected.</p> </asp:Panel> <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" DynamicServicePath="" Enabled="True" OkControlID="btnSelDeg" PopupControlID="pnlSelDeg" TargetControlID="HiddenField1"> </asp:ModalPopupExtender>For the RadioButtonList Selection;
Protected Sub radInqRel_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles radInqRel.SelectedIndexChanged If Request.QueryString("prog") = "Hill Center" And radInqRel.SelectedIndex = 0 Then SubName.Text = InqName.Text End If If radInqRel.SelectedIndex = 3 And Not IsPostBack Then ModalPopupExtender1.Show() ElseIf radInqRel.SelectedIndex = 2 Then MoreInfo.Visible = False End If End SubI thought that by adding the And Not IsPostBack would work, but it didnt. Any help would be appreciated. Thanks in Advance, NickG
sushanth009
Contributor
6243 Points
1168 Posts
Re: ModalPopupExtender shows after AutoPostBack
Feb 16, 2012 07:52 PM|LINK
Firstly I see you are missing the Selected IndexChcnged for the RadioButtonList. It is defined in the code behind but it is not associated with your RadioButtonList control..
<asp:RadioButtonList ID="radInqRel" runat="server" RepeatColumns="2" Width="500px" CssClass="style66" AutoPostBack="True">If this does not work then try removing the HiddenField from inside the panel and paste it outside the panel.
Second remove the IsPostBack condition as it makes no sense
If radInqRel.SelectedIndex = 3 Then ModalPopupExtender1.Show()See if this works..
NickG21
Member
46 Points
42 Posts
Re: ModalPopupExtender shows after AutoPostBack
Feb 17, 2012 12:41 PM|LINK
That worked, also I didn't realize but I had functionality in the Page_Load, which wasn't checking if things were a postback. Thank you for your help, and helping me realize another thing to check on with the associations of the back-end code. I appreciate it.
-NickG