由於某種原因,我無法從代碼隱藏頁面引用我的引導頁面上的任何控件。作爲一個例子,我已經嘗試調用txtUsername控件,但是在代碼隱藏中,它無法識別控件。我試圖重新創建頁面,但仍然沒有。 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
末級
謝謝,完美的工作,不相信我錯過了那一個。 – Terence