2017-05-30 4 views
0

何らかの理由で、コードビハインドページのブートストラップページのコントロールを参照できません。例として、txtUsernameコントロールを呼び出そうとしましたが、コードビハインドでコントロールを認識しません。私はページを再作成しようとしましたが、まだ何もありません。 txtUsernameは、ASP制御ではないためだtxtUsername not recognisedコードビハインドのブートストラップページのコントロールを呼び出すことができません

私のウェブページ

 <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="~/Access/login.aspx.vb" Inherits="Icon.login" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server" > 
<link rel="stylesheet" type="text/css" 
ref="../StyleSheets/bootstrap/bootstrap.css"> 
     <link rel="stylesheet" type="text/css" href="../StyleSheets/template/login.css"> 
     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css"> 
     <link href='https://fonts.googleapis.com/css?family=Passion+One' rel='stylesheet' type='text/css'> 
     <link href='https://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'> 
     <title>Admin</title> 
</head> 
<body> 
<div class="container"> 
    <div class="container"> 
      <div class="row main"> 
       <div class="panel-heading"> 
        <div class="panel-title text-center"> 
         <h2 class="title">Icon Enterprise</h1> 
         <hr /> 
        </div> 
       </div> 
       <div class="main-login main-center"> 
        <form class="form-horizontal" method="post" action="#"> 

         <div class="form-group"> 
          <label for="txtUsername" id="lblUsername" class="cols-sm-2 control-label">Username</label> 
          <div class="cols-sm-10"> 
           <div class="input-group"> 
            <span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span> 
            <input type="text" class="form-control" name="txtUsername" id="txtUsername" placeholder="Your Username"/> 
           </div> 
          </div> 
         </div> 

         <div class="form-group"> 
         <label for="txtPassword" id="lblPassword" class="cols-sm-2 control-label">Password</label> 
          <div class="cols-sm-10"> 
           <div class="input-group"> 
            <span class="input-group-addon"><i class="fa fa-key fa" aria-hidden="true"></i></span> 
            <input type="password" class="form-control" name="txtPassword" id="txtPassword" placeholder="Your Password"/> 
           </div> 
           <div> 
           <label id="lblError" style="color:Red">Incorrect Username or Password</label> 
           </div> 
          </div> 
         </div> 

         <div class="form-group "> 
          <button type="button" class="btn btn-primary btn-lg btn-block login-button">Submit</button> 
         </div> 
        </form> 
       </div> 
      </div> 
     </div> 
     <script type="text/javascript" src="../Scripts/bootstrap/bootstrap.js"></script> 
</body> 
</html> 

マイ分離コードページ

Public Class login 
Inherits System.Web.UI.Page 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 

End Sub 

エンドクラス

答えて

1

、サーバはそれについて知っていません。何をしたい

は次のとおりです。

<asp:TextBox ID="txtUsername" runat="server"></asp:TextBox> 
+0

ありがとう、それは完全に働いた、私はそれを逃したとは思わない。 – Terence

0

あなたがあなたのコントロールでrunat="server"
を置くか、ASPを使用するか、そのための
をお使いの.csファイルには使用できなくなりますHTML入力コントロールを使用しています.netテキストボックス

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> 
関連する問題