Asked by:
Modal Popup

Question
-
User-1499457942 posted
Hi
I want if successfully done Modal Popup should appear with message Successfully Completed OK
<asp:Content ID="Content1" ContentPlaceHolderID="MContentPlaceHolder" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div class="row"> <div class="center"> <div class="form-group"> <label for="Select" class="col-lg-2 control-label">Select </label> <asp:DropDownList ID="ddlfruit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChanged" CssClass="btn btn-default btn-sm"> <asp:ListItem Text="Apple" Value ="1"/> <asp:ListItem Text="Mango" Value ="2"/> </asp:DropDownList> </div> </div> </div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlfruit" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> </asp:Content> protected void OnSelectedIndexChanged(object sender, EventArgs e) { int ddlValue = Convert.ToInt32(ddlUp.SelectedItem.Value); if (ddlValue == 1) { Fun1(); } }
Thanks
Thursday, July 26, 2018 10:58 AM
All replies
-
User-1171043462 posted
Refer
Open (Show) ASP.Net AJAX ModalPopupExtender Modal Popup from Code Behind (Server Side) in ASP.Net
Thursday, July 26, 2018 11:51 AM -
User1724605321 posted
Hi JagjitSingh ,
If you are using Bootstrap Model popup and want to show the model popup after select change of the dropdownlist , you could refer to below code sample :
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"> <script type="text/javascript"> function ShowPopup() { $("#btnShowPopup").click(); } </script> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <div class="row"> <div class="center"> <div class="form-group"> <label for="Select" class="col-lg-2 control-label">Select </label> <asp:DropDownList ID="ddlfruit" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OnSelectedIndexChanged" CssClass="btn btn-default btn-sm"> <asp:ListItem Text="Apple" Value="1" /> <asp:ListItem Text="Mango" Value="2" /> </asp:DropDownList> </div> </div> </div> <button type="button" style="display: none;" id="btnShowPopup" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal"> Launch demo modal </button> <div class="modal fade" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span></button> <h4 class="modal-title"> Registration done Successfully</h4> </div> <div class="modal-body"> <asp:Label ID="lblMessage" runat="server" /> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"> Close</button> <button type="button" class="btn btn-primary"> Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID="ddlfruit" EventName="SelectedIndexChanged" /> </Triggers> </asp:UpdatePanel> </asp:Content>
Code behind :
protected void OnSelectedIndexChanged(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "MyScript", "ShowPopup()", true); this.lblMessage.Text = "All process is complete"; }
Best Regards,
Nan Yu
Friday, July 27, 2018 6:48 AM