我开始学习简单的 C#。请帮助我如何将HTML参数传递给.ASPX页面到.CS页面?
索引.axpx 页
<div class="title">
<h4>
User Login</h4>
<div class="option">
Sign up for free »</div>
</div>
<div class="content">
<form method="post" runat="server">
<div>
<input type="text" runat="server" id="username" name="username" value="" placeholder="username"/>
</div>
<div>
<input type="password" runat="server" id="password" name="password" value="" placeholder="password"/>
</div>
<div>
<input type="button" runat="server" value="Submit" id="submit" onclick=" button_onclick()" />
</div>
</form>
<!-- ## / Panel Content -->
</div>
索引.aspx.cs 页
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private void button_onclick(object sender, EventArgs e)
{
string uname = Request[username.UniqueID];
string pass = Request[password.UniqueID];
}
}