我已经编写了用于发布复选框值的 html 代码
<form action="Default2.aspx" method="post" target="_blank">
<input type="checkbox" id="c1" name="attempt" value="101"> I'st attempt<br>
第二次尝试
那么我应该如何编写代码以在 c#asp 中访问这个发布的值?
protected void Page_Load(object sender, EventArgs e)
{
HttpContext context = HttpContext.Current;
NameValueCollection nvc = context.Request.Form;
string userName = nvc["c1"];
string passWord = nvc["c2"];
TextBox1.Text = userName;
TextBox2.Text = passWord;
}
它无法正常工作