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
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
解决方案 »
- vs 2008 在连接 sql server express 时提示:this version of server is not supported
- aspnet中从sql导出到excel2007时为乱码
- aspx页面问题和MSChart控件绘制雷达图如何实现数据绑定问题探究。
- 关于FreeTextbox的问题,从客户端检测到有潜在危险的Request.Form 值
- dataset绑定dataGird的小问题
- 如何使GridView在记录为空的时候显示并在footer添加数据?
- Asp.net和C#页面关联的问题
- pwqzc(一帆) 过来拿分!
- 7482053请加入这个群!
- 请问怎样在asp.net下把object转为byte? 請用VB写 在线等
- 表达式中 'replace' 函数未定义错误?
- 关于DATAGRID删除的问题
{
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");
}
}
_callBackResult = "One|Two|Three";
} else if (eventArgument == "Item 2") {
_callBackResult = "Four|Five|Six";
} else if (eventArgument == "Item 3") {
_callBackResult = "Seven|Eight|Nine";
} else {
_callBackResult = "";
}
{
return _callBackResult;
}
Implements ICallbackEventHandler
Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent
{
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;
}
}
}