是否可以调用ASP.NET中设置为onclick函数的函数?
我试过了,但出现了以下错误:是否可以调用ASP.NET中设置为onclick函数的函数?,asp.net,onclick,Asp.net,Onclick,我试过了,但出现了以下错误: Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code app
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30201: Expression expected.
Source Error:
Line 26: password.Text = parseQuery("pass")
Line 27: End If
Line 28: If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)
Line 29: End If
Line 30:
Source File: C:\Inetpub\wwwroot\devv\login.aspx.vb Line: 28
“/”应用程序中出现服务器错误。
编译错误
描述:编译服务此请求所需的资源时出错。请查看以下特定错误详细信息,并适当修改源代码。
编译器错误消息:BC30201:应为表达式。
源错误:
第26行:password.Text=parseQuery(“pass”)
第27行:如果结束
第28行:如果是password.Text“”和username.Text“”,则btnLogin\u单击(将发送者作为对象,将e作为系统.EventArgs)
第29行:如果结束
第30行:
源文件:C:\Inetpub\wwwroot\devv\login.aspx.vb行:28
尝试将您的语句改为
If password.Text <> "" And username.Text <> "" Then
btnLogin_Click(Nothing, Nothing)
End If
如果password.Text“”和username.Text“”,则
btnLogin\u单击(无,无)
如果结束
您当前的代码正在使用签名,就好像您正在创建按钮单击事件一样,您只需将一些伪参数传递到方法中,前提是它已被编写
但是,如果您通过各种方法触发登录,我建议您编写第二个方法ProcessLogin或类似的东西,让您的按钮单击事件直接重定向到那里。这将使您的登录处理更容易有多个“输入向量”。尝试将您的语句改为
If password.Text <> "" And username.Text <> "" Then
btnLogin_Click(Nothing, Nothing)
End If
如果password.Text“”和username.Text“”,则
btnLogin\u单击(无,无)
如果结束
您当前的代码正在使用签名,就好像您正在创建按钮单击事件一样,您只需将一些伪参数传递到方法中,前提是它已被编写
但是,如果您通过各种方法触发登录,我建议您编写第二个方法ProcessLogin或类似的东西,让您的按钮单击事件直接重定向到那里。这将使您的登录处理更容易有多个“输入向量”。您需要将第28行从
If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)
如果是password.Text“”和username.Text“”,则单击btnLogin\u(将发送者设置为对象,将e设置为System.EventArgs)
到
如果password.Text“”和username.Text“”,则btnLogin\u单击(无,EventArgs.Empty)
您需要将第28行从
If password.Text <> "" And username.Text <> "" Then btnLogin_Click(Dim sender as Object, Dim e as System.EventArgs)
如果是password.Text“”和username.Text“”,则单击btnLogin\u(将发送者设置为对象,将e设置为System.EventArgs)
到
如果password.Text“”和username.Text“”,则btnLogin\u单击(无,EventArgs.Empty)
需要查看您的源代码…我已经很久没有写VB了。你能在函数调用中调暗变量吗?为什么不干脆什么都不用?@Joel:不,这就是为什么它甚至不能编译。我需要看看你的源代码……我写VB已经太久了。你能在函数调用中调暗变量吗?为什么不干脆什么都不用?@Joel:不,这就是为什么它甚至不能编译。这是我认为应该的,但我对VB知识不够自信+推荐一个单独的ProcessLogin方法。这是我认为应该的,但我对VB知识不够自信+1用于推荐单独的ProcessLogin方法。