Shoot -- I've been having problems with connectivity on my server.
Here's the code. Code-behind for the page:
Partial Class CallBack_DB_aspx Implements System.Web.UI.ICallbackEventHandler
Protected ZipTable As Hashtable Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) _ Handles Me.Load ZipTable = New Hashtable() ZipTable.Add("98106", "Seattle") ZipTable.Add("10270", "New York") ZipTable.Add("95110", "San Jose")
Dim cbReference As String = Page.GetCallbackEventReference(Me, _ "arg", "GetServerData", "context") Dim callbackScript As String = "" callbackScript &= "function CallTheServer(arg, context)" callbackScript &= vbCrLf & "{" callbackScript &= vbCrLf & " " & cbReference & ";" callbackScript &= vbCrLf & "}" Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _ "CallTheServer", callbackScript, True) End Sub
Public Function RaiseCallbackEvent(ByVal eventArgument As String) _ As String Implements _ System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent Dim city As String If ZipTable(eventArgument) Is Nothing Then city = "Not found" Else city = ZipTable(eventArgument).ToString() End If Return city End Function End Class
mikepope
Contributor
5776 Points
1155 Posts
AspNetTeam
Microsoft
Moderator
Re: Sample ASP.net 2.0' Client callback
Aug 26, 2005 04:57 AM|LINK
Here's the code. Code-behind for the page:
Here's the page:
ASP.NET User Education
This posting is provided "AS IS" with no warranties, and confers no rights.