【发布时间】:2013-03-04 05:33:22
【问题描述】:
我在 JavaScript 中嵌套了 razor C#,我在一个按钮内调用了这个函数,但是当我按下按钮时没有任何反应。我做错了什么?
<script>
@functions{
public void Validation()
{
StudentTable sTable = new StudentTable();
var username = Request["username"];
var password = Request["password"];
var error = "";
if(sTable.Login(username, password) != null)
{
Response.Redirect("Success.html");
}
else
{
error = "Username/password entered is incorrect";
}
</script>
}
}
<p>@error</p>
<button class="btn btn-default btn-primary" id="signin" type="submit" value="Signin" onclick="@functions" formmethod="post">Sign in</button>
【问题讨论】:
标签: javascript razor asp.net-webpages