我在以下代码中遇到了一些问题。我有asp.net按钮,它的onclick事件没有触发。我使用了断点。
HTML代码
<asp:Button runat="server" ID="btnSubmit" Style="width: 296px; height: 50px; margin-bottom: 30px; background: #f3b407;" CssClass="btn btn-info" OnClick="btnSubmit_Click" Text="LOGIN" />
C#代码
protected void btnSubmit_Click(object sender, EventArgs e)
{
EazySuppliesManager em = new EazySuppliesManager();
string username = txtboxusername.Text;
string password = txtboxpassword.Text;
List<Customer> lsts = em.GetCustomerLogin(username, password);
int count = lsts.Count;
if (count > 0)
{
txtboxusername.Text = "";
txtboxpassword.Text = "";
Customer cust = lsts.First();
Session["Customer"] = cust;
Response.Redirect("Index", false);
login_btn.Attributes.Add("display", "none");
lblusername.Text = "Welcome," + " " + cust.Username;
}
else
{
Session["Customer"] = null;
}
}
这是调试时按钮在浏览器中的显示方式
<input type="submit" style="width: 296px; height: 50px; margin-bottom: 30px; background: #f3b407;" class="btn btn-info" id="btnSubmit" value="LOGIN" name="ctl00$btnSubmit">
请参阅此处没有onlclick事件。只需要一点帮助。 Thanx提前