注:在页面中有一个button和dropdownlist两个控件,用dropdownlist模拟button的服务端事件.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnResponse.Click
Response.Write("您选择了: " + Me.ddlValue.SelectedValue.ToString)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim cm As ClientScriptManager = Page.ClientScript
Dim strCMD As String = cm.GetPostBackClientHyperlink(btnResponse, "")
Me.ddlValue.Attributes.Add("onchange", strCMD)
End Sub
End Class