ASP.NET LoginForm更改LoginButton cssClass onclick

时间:2016-05-17 06:30:24

标签: c# asp.net

我有以下代码,前端(只是相关代码):

<asp:Login ID="Login1" runat="server" OnAuthenticate="ValidateUser">

<td align="right" colspan="2">
<asp:Button ID="LoginButton" runat="server" CssClass="btn btn-success" CommandName="Login" Text="Log Ind" ValidationGroup="Login1" />
</td>

然后在后端代码中我希望在单击时更改LoginButton的backgroundcolor。但我似乎无法在我的ValidateUser函数中按住该按钮?

我只有以下选项:

Login1.LoginButtonImageUrl
Login1.LoginButtonStyle
Login1.LoginButtonText
Login1.LoginButtonType

1 个答案:

答案 0 :(得分:1)

如果你没有或没有访问asp控件上的所有属性,在这种情况下是在登录表单中,诀窍是首先在此表单中找到它然后做你做的喜欢。在您的情况下,代码将为:

LocalJumpError