I'm ge开发者_JS百科tting a build error, "Expression is not a method" for the following code
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
Any thoughts or suggestions?
It's because you've declared a local variable with the same name in the method:
Dim lookup As String = ClientScript.GetPostBackEventReference(txtSKU, "", False)
In short, don't do that :) Simply rename the variable and it should be fine.
you have declared lookup string within the same method and also lookup function.
Change name of your string and it will work.
精彩评论