Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ASP.NET表达式不是方法_Asp.net - Fatal编程技术网

ASP.NET表达式不是方法

ASP.NET表达式不是方法,asp.net,Asp.net,我得到一个生成错误,下面代码的“表达式不是方法” Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'LOOKUP SKU DATA ON BLUR Dim lookup As String = ClientScript.GetPostBackEventReference(txtSKU, "", False)

我得到一个生成错误,下面代码的“表达式不是方法”

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          'LOOKUP SKU DATA ON BLUR
          Dim lookup As String = ClientScript.GetPostBackEventReference(txtSKU, "", False)
          txtSKU.Attributes.Add("onblur", "doLookup()")

          If Not IsPostBack Then
               If txtSKU.Text <> "" Then
                    lookup() '*************the error points to this line*******
               End If
          End If

     End Sub

     Protected Sub btnLookup_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles btnLookup.Command
          lookup()
     End Sub

     Protected Sub lookup()
          'BLAH BLAH BLAH
     End Sub
Protected Sub Page_Load(ByVal sender作为对象,ByVal e作为System.EventArgs)处理Me.Load
'查找模糊上的SKU数据
Dim查找为String=ClientScript.GetPostBackEventReference(txtSKU,”,False)
Add(“onblur”,“doLookup()”)
如果不是的话,我会回来的
如果txtSKU.Text为“”,则
lookup()'**********错误指向此行*******
如果结束
如果结束
端接头
受保护的子btnLookup_命令(ByVal sender作为对象,ByVal e作为System.Web.UI.WebControls.CommandEventArgs)处理btnLookup.Command
查找()
端接头
受保护的子查找()
“废话废话
端接头

有什么想法或建议吗?

这是因为您在方法中声明了一个同名的局部变量:

Dim lookup As String = ClientScript.GetPostBackEventReference(txtSKU, "", False)

简而言之,不要这样做:)只需重命名变量就可以了。

这是因为您在方法中声明了一个同名的局部变量:

Dim lookup As String = ClientScript.GetPostBackEventReference(txtSKU, "", False)

简而言之,不要这样做:)只需重命名变量就可以了。

您已经在同一个方法中声明了lookup string,还声明了lookup函数


更改字符串的名称,它将起作用。

您已经在同一方法中声明了查找字符串,还声明了查找函数


更改字符串的名称,它就会工作。

谢谢!我真该自己抓住的!最好再煮一杯咖啡!谢谢我真该自己抓住的!最好再煮一杯咖啡!