当 Ajax 页面方法函数返回成功并且没有按钮单击作为受保护的子对象时,我需要调用一个函数。我无法将 ClientScript 直接包含在方法或共享函数中,并且该方法不允许在没有Shared的情况下调用Public Sub UpdateText() ...任何想法?
'''' Method for Ajax with SQL and other functions
'''' ----------------------------------------------------------
<WebMethod()> _
Public Shared Function SendOrder(ByVal fulldata As String,
_ByVal id As Integer) As String
Try
UpdateText()
Return "Success"
Catch ex As Exception
Return "failure"
End Try
End Function
这是我需要调用的函数
'''' Function to call only on success
'''' ----------------------------------------------------------
Public Sub UpdateText()
Dim jsUpdate As String
Dim cstype As Type
Dim cs As ClientScriptManager = Page.ClientScript
Dim jsUpdateTxt As String = "<script language='javascript'>...</script>"
ClientScript.RegisterStartupScript(cstype, jsUpdate, jsUpdateTxt)
End Sub