[Solved] ASP.Net Error: A page can have only one server-side Form tag

Last Reply one month ago By harindaw

Posted one month ago

Hi 

I want use two forms with runat ="server" tag with in one page. I need to hide the second form and open with button click. When I do that error says that"

A page can have only one server-side Form tag.

How can I fix this by using two forms with runat="server" tag?

Also can I know how to open a div frame or Form in different page. (open button is in page 1 and form is in page2,want to open form in page 2 from page 1)

Tell me how to pop up a Div frame in page 2 from a button in page 1

Ex:

My div is in aspx Page 2

Div id is modalForm1

I want to open modalform1 from aspx page 1

Your help would be greatly appreciated

Thanks & Regards,

Harinda

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
   <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Main CSS-->
    <link rel="stylesheet" type="text/css" href="css/main.css">
    <!-- Font-icon css-->
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <title>Login - handis IMS Admin</title>
  </head>
  <body>
    <section class="material-half-bg">
      <div class="cover"></div>
    </section>
    <section class="login-content">
      <div class="logo">
        <h1><img src="images/logo-main.png" alt="" /></h1>
      </div>
      <div class="login-box">
        <form class="login-form" id="form1" runat="server" method ="post">
          <h3 class="login-head"><em class="fa fa-lg fa-fw fa-user"></em>SIGN IN</h3>
         
          <div class="form-group">
            <label class="control-label">EMAIL</label>
            <asp:TextBox ID="txtEmail" runat="server" Class="form-control" type="Email" placeholder="Enter Email" required />
          </div>
          <div class="form-group">
            <label class="control-label">PASSWORD</label>
               <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Class="form-control" placeholder="Enter Password" required/>
          </div>
          <div class="form-group">
            <div class="utility">
              <div class="animated-checkbox">
                <label>
                       <asp:CheckBox ID="chkRememberMe" Text="" runat="server"/><span class="label-text">Stay Signed in</span>
                </label>
              </div>
              <p class="semibold-text mb-2"><a href="#" data-toggle="flip">Forgot Password ?</a></p>
            </div>
          </div>
          <div class="form-group btn-container">
                <asp:Button ID="btnLogin" Text="Login" runat="server" OnClick="ValidateUser" class="btn btn-primary btn-block" /> 
              <div id="dvMessage" runat="server" visible="false" class="alert alert-danger">
            <strong>Error!</strong>
            <asp:Label ID="lblMessage" runat="server" />
        </div>
          </div>
        </form>
        <form class="forget-form" id="Form9" method = "post"  runat ="server">
          <h3 class="login-head"><i class="fa fa-lg fa-fw fa-lock"></i>Forgot Password ?</h3>
          <div class="form-group">
            <label class="control-label">EMAIL</label>
            <asp:TextBox ID="txtEmailfgt" runat="server" Class="form-control" type="Email" placeholder="Enter Email" required />
          </div>
          <div class="form-group btn-container">            
                <asp:Button ID="btnReset" Text="RESET" runat="server" OnClick="ResetPassword" class="btn btn-primary btn-block" /> 
          </div>
          <div class="form-group mt-3">
            <p class="semibold-text mb-0"><a href="#" data-toggle="flip"><i class="fa fa-angle-left fa-fw"></i> Back to Login</a></p>
          </div>
        </form>
      </div>
    </section>
    <!-- Essential javascripts for application to work-->
    <script src="js/jquery-3.3.1.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/main.js"></script>
    <!-- The javascript plugin to display page loading on top-->
    <script src="js/plugins/pace.min.js"></script>
    <script type="text/javascript">
      // Login Page Flipbox control
      $('.login-content [data-toggle="flip"]').click(function() {
      	$('.login-box').toggleClass('flipped');
      	return false;
      });
    </script>
  </body>
</html>

 


Posted one month ago

Hi Dharmendhr,

Thank you for your quick response

With your answer I manged to get a fix from below link

https://www.aspsnippets.com/Articles/Close-Hide-Bootstrap-Modal-Popup-Window-from-Server-Side-Code-Behind-in-ASPNet.aspx

Thank you again for your support. Let me know how I can support you

Thanks & Regards,

Harinda