Partial Class wfrmHome
Inherits System.Web.UI.Page
Implements ICallbackEventHandler
Private callbackresult As String
Private Sub Page_Load(ByVal source As Object, ByVal e As System.EventArgs)
Dim callBack As String = Page.ClientScript.GetCallbackEventReference(Me, "arg", "ClientCallback", "context", "ClientCallbackError", False)
Dim clientFunction As String = "function Search(arg, context){ " & callBack & "; }"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "Search", clientFunction, True)
End Sub
Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
Return callbackresult
End Function
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
Dim a As MyData = New MyData
Dim dt As Data.DataTable = a.searchClient(eventArgument, "dc9974")
If dt.Rows.Count > 50 Then
callbackresult = "0^...searching..."
ElseIf dt.Rows.Count = 0 Then
callbackresult = "0^...no clients found..."
Else
Dim str As String = ""
Dim i As Integer = 0
Do While i < dt.Rows.Count
str += dt.Rows(i)("clientID") & "^" & dt.Rows(i)("clientName") & "|"
i += 1
Loop
callbackresult = str.Remove(str.LastIndexOf("|"), 1)
End If
dt.Dispose()
dt = Nothing
a.Dispose()
a = Nothing
End Sub
Protected Sub btnSelect_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelect.Click
Dim cID As Integer = CInt(Request.Form("listbox"))
End Sub
End Class