sumit sankpal

sumit sankpal

  • 1.7k
  • 68
  • 2k

showing aspx page as a popup

Mar 28 2024 5:36 AM

i have two pages one in index.html and one in EnquireTest.aspx 


<div class="navbar-buttons mbr-section-btn">
    
    <a class="btn btn-primary display-10" data-toggle="modal" id="openModal" data-target="#myModal"> Enquire now</a>
</div>

after clicking above popup will get open, popup code

 <div class="modal fade" id="myModal">
     <div class="modal-dialog">
         <div class="modal-content">

             <!-- Modal Header -->
             <div class="modal-header">
                 <h5 class="modal-title text-primary">Fill out the form below to get the specific knowledge needed to become skilled in any discipline</h5>
                 <button type="button" class="close" data-dismiss="modal">&times;</button>
             </div>

             <!-- Modal body -->
             <div class="modal-body" id="modalBody">
                 <!-- Content from your ASPX page will be loaded here -->                 
                 <iframe src=redirecting to my aspx page style="width: 100%; height: 100%; border: none;" scrolling="no"></iframe>

             </div>



         </div>
     </div>
 </div>

and below is my aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EnquireTest.aspx.cs" Inherits="ApplicationForm.LandingPage.EnquireTest" %>

<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
<!DOCTYPE html>

<html >
<head runat="server">


    <title></title>
   
</head>


<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true">
                <ContentTemplate>

                    <div class="row">
                        <div class="">
                            <%--<asp:Label ID="Namelbl" runat="server"  Text="FULL NAME :"></asp:Label>--%>
                        </div>
                    </div>
                    <div class="row">
                        <div class="">
                            <asp:TextBox ID="txtName" runat="server" class="form-control form-control-sm  mb-9" placeholder="FULL NAME"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvtxtName" runat="server" ControlToValidate="txtName"
                                ErrorMessage="*" Font-Bold="False" Font-Names="Verdana" Font-Size="8pt"
                                SetFocusOnError="True" ValidationGroup="v1" ForeColor="Red"></asp:RequiredFieldValidator>
                        </div>


                        <div class="row">
                            <%--<asp:Label ID="EmailID" runat="server" Text="Email ID :"></asp:Label>--%>
                        </div>
                    </div>
                    <div class="row">
                        <%-- <div class="">
                                <asp:TextBox ID="txtEmailID" runat="server" placeholder="Email ID" class="form-control form-control-sm  mb-9"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvtxtEmailID" ControlToValidate="txtEmailID" SetFocusOnError="True" runat="server" class="text-danger" ErrorMessage="*" ValidationGroup="v1"></asp:RequiredFieldValidator>
                            </div>--%>
                        <div class="">
                            <asp:TextBox ID="txtEmailID" runat="server" placeholder="Email ID" class="form-control form-control-sm mb-9"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="revtxtEmailID" ControlToValidate="txtEmailID" SetFocusOnError="True" runat="server" class="text-danger" ErrorMessage="Invalid Email ID" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ValidationGroup="v1"></asp:RegularExpressionValidator>
                            <asp:RequiredFieldValidator ID="rfvtxtEmailID" ControlToValidate="txtEmailID" SetFocusOnError="True" runat="server" class="text-danger" ErrorMessage="*" ValidationGroup="v1"></asp:RequiredFieldValidator>
                        </div>

                    </div>
                    <div class="row">
                        <div class="">
                            <%--<asp:Label ID="lblMobileNo" runat="server" Text="Mobile No. :"></asp:Label>--%>
                        </div>
                    </div>
                    <div class="row">
                        <%-- <div class="">
                                <asp:TextBox ID="txtMobileNo" runat="server" MaxLength="10" onkeypress="return isNumberKey(event)" placeholder="Mobile No." class="form-control form-control-sm  mb-9"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfvtxtMobileNo" ControlToValidate="txtMobileNo" SetFocusOnError="True" runat="server" class="text-danger" ErrorMessage="*" ValidationGroup="v1"></asp:RequiredFieldValidator>
                            </div>--%>
                        <div class="">
                            <asp:TextBox ID="txtMobileNo" runat="server" MaxLength="10" placeholder="Mobile No." class="form-control form-control-sm mb-9"></asp:TextBox>
                            <asp:RegularExpressionValidator ID="revtxtMobileNo" ControlToValidate="txtMobileNo" SetFocusOnError="True" runat="server"
                                class="text-danger" ErrorMessage="Invalid Mobile No." ValidationExpression="^[9876]\d{9}$" ValidationGroup="v1"></asp:RegularExpressionValidator>
                            <asp:RequiredFieldValidator ID="rfvtxtMobileNo" ControlToValidate="txtMobileNo" SetFocusOnError="True" runat="server" class="text-danger" ErrorMessage="*" ValidationGroup="v1"></asp:RequiredFieldValidator>
                        </div>

                    </div>
                    <div class="row">
                        <div class="">
                            <%--<asp:Label ID="lblLocation" runat="server" Text="Location :"></asp:Label>--%>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-9 ml-4">
                            <asp:DropDownList ID="ddlLocations" runat="server" OnSelectedIndexChanged="ddlLocations_SelectedIndexChanged" AutoPostBack="true" class="form-control form-control-sm  mb-9">
                                <asp:ListItem Value="0">Select Locations</asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvddlLocations" runat="server" ControlToValidate="ddlLocations" InitialValue="0"
                                ErrorMessage="*" Font-Bold="False" Font-Names="Verdana" Font-Size="8pt"
                                SetFocusOnError="True" ValidationGroup="v1" ForeColor="Red"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="row">
                        <div class="">
                            <%--<asp:Label ID="lblCourse" runat="server" Text="Course :"></asp:Label>--%>
                        </div>
                    </div>
                    <div class="row">
                        <div class="">
                            <asp:DropDownList ID="ddlCourse" runat="server" class="form-control form-control-sm  mb-9">
                                <asp:ListItem Value="0">Select Course</asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="rfvddlCourse" runat="server" ControlToValidate="ddlCourse" InitialValue="0"
                                ErrorMessage="*" Font-Bold="False" Font-Names="Verdana" Font-Size="8pt"
                                SetFocusOnError="True" ValidationGroup="v1" ForeColor="Red"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="row">
                        <div class="">
                            <asp:TextBox ID="txtCaptcha" runat="server" class="form-control form-control-sm  mb-9" placeholder="Enter Captcha"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvtxtCaptcha" runat="server" ControlToValidate="txtCaptcha" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                        </div>
                    </div>
                    <div class="row">
                        <div class="">

                            <cc1:CaptchaControl ID="Captcha1" runat="server" CaptchaBackgroundNoise="Low" CaptchaLength="5"
                                CaptchaHeight="60" CaptchaWidth="200" CaptchaMinTimeout="5" CaptchaMaxTimeout="240"
                                FontColor="#D20B0C" NoiseColor="#B1B1B1" />
                        </div>
                    </div>


                    <div class="">
                        <asp:ImageButton ImageUrl="~/Application/refresh.png" runat="server" CausesValidation="false" />

                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>

        <div class="">
            <asp:Button ID="btnSubmit" OnClick="btnSubmit_Click" ValidationGroup="v1" class="btn btn-primary" runat="server" Text="Submit" />
        </div>
    </form>

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
     <script src="../vendor/jquery/jquery.min.js"></script>
  <script src="../vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
  <script src="../vendor/jquery-easing/jquery.easing.min.js"></script>
  <script src="../js/ruang-admin.min.js"></script>

   



       
</body>
</html>

and this is my is my EnquireTest.aspx.cs

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
     if (Captcha1.UserValidated)
     {
         DataSet dss = new DataSet();
         a.Mode = "InsertEnquiry";
         a.StudentName = txtName.Text.Trim();
         a.EmailID = txtEmailID.Text.Trim();
         a.MobileNumber = txtMobileNo.Text.Trim();
         a.Location = ddlLocations.SelectedItem.Text.ToString();
         a.Course = ddlCourse.SelectedItem.Text.Trim();
         dss = objDal.getEnquiry(a);
         if (dss.Tables[0].Rows.Count > 0)
         {
             // Display success message
             txtName.Text=string.Empty;
             txtEmailID.Text = string.Empty;
             txtMobileNo.Text = string.Empty;
             ddlLocations.SelectedIndex = 0;
             ddlCourse.SelectedIndex = 0;
             txtCaptcha.Text = string.Empty;
             ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Information saved succesfully')", true);
           
         }
         else
         {
             // Display error message
             ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Error in inserting Application')", true);
         }
     }
     else
     {
         // Display captcha error message
         ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Enter Correct Captcha Code')", true);
     }
 }

after clicking on submit textbox value is not getting to empty. it is still showing entered value. and also the after clciking on submit debugger is not getting called.
Please give me solution.


Answers (1)