Partial Class CallBackEventHandler_vb
    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 GetChildren(arg, context){ " & callBack & "; }"
        Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "GetChildren", clientFunction, True)        If Page.IsPostBack AndAlso Not Page.IsCallback Then            Label1.Text = "You Selected: " & Request.Form("ParentDropDown") & ": " & Request.Form("ChildDropDown")
        End If
    End Sub    Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
        Select Case eventArgument            Case "Item 1"
                _callBackResult = "One|Two|Three"
            Case "Item 2"
                _callBackResult = "Four|Five|Six"
            Case "Item 3"
                _callBackResult = "Seven|Eight|Nine"
            Case Else
                _callBackResult = ""
        End Select
    End Sub    Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
        Return _callBackResult
    End Function
End Class

解决方案 »

  1.   

    理解了c#和VB。Net的语法就没有什么问题了dim  as int = int 变量
      

  2.   

    private void Page_Load(object source, System.EventArgs e) 

     string callBack = Page.ClientScript.GetCallbackEventReference(this, "arg", "ClientCallback", "context", "ClientCallbackError", false); 
     string clientFunction = "function GetChildren(arg, context){ " + callBack + "; }"; 
     Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "GetChildren", clientFunction, true); 
     if (Page.IsPostBack && !(Page.IsCallback)) { 
       Label1.Text = "You Selected: " + Request.Form("ParentDropDown") + ": " + Request.Form("ChildDropDown"); 
     } 
    }
      

  3.   

    if (eventArgument == "Item 1") { 
     _callBackResult = "One|Two|Three"; 
    } else if (eventArgument == "Item 2") { 
     _callBackResult = "Four|Five|Six"; 
    } else if (eventArgument == "Item 3") { 
     _callBackResult = "Seven|Eight|Nine"; 
    } else { 
     _callBackResult = ""; 
    }
      

  4.   

    public string GetCallbackResult() 

     return _callBackResult; 
    }
      

  5.   

    主要是下面语句不清楚:
        Implements ICallbackEventHandler
     Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
      

  6.   

    http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx
      

  7.   

    internal class CallBackEventHandler_vb : Page, ICallbackEventHandler
    {
        private string _callBackResult;    public string GetCallbackResult()
        {
            return this._callBackResult;
        }    private void Page_Load(object source, EventArgs e)
        {
            string text1 = this.Page.ClientScript.GetCallbackEventReference(this, "arg", "ClientCallback", "context", "ClientCallbackError", false);
            string text2 = "function GetChildren(arg, context){ " + text1 + "; }";
            this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "GetChildren", text2, true);
            if (this.Page.IsPostBack && !this.Page.IsCallback)
            {
                this.Label1.Text = "You Selected: " + this.Request.Form["ParentDropDown"] + ": " + this.Request.Form["ChildDropDown"];
            }
        }    public void RaiseCallbackEvent(string eventArgument)
        {
            switch (eventArgument)
            {
                case "Item 1":
                    _callBackResult = "One|Two|Three";
                    break;
                case "Item 2":
                    _callBackResult = "Four|Five|Six";
                    break;
                case "Item 3":
                    _callBackResult = "Seven|Eight|Nine";
                    break;
                default:
                    _callBackResult = "";
                    break;
            }
        }
    }