如何获得RadControl radcombobox的Dropdown Change事件

时间:2014-06-02 13:06:30

标签: vb.net webforms ascx radcombobox rad-controls

我有以下控件:

<radcb:radcombobox id="rdCboState" Runat="server" CssClass="Control" height="200" text="--Select--"
    EnableLoadOnDemand="false" width="100" MarkFirstMatch="True" skin="WindowsXP"></radcb:radcombobox>

我已将此子例程添加到我的.ascx.vb代码后面:

Private Sub rdCboState_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    testBinding.Text = "Test"
End Sub

但是,当我更改testBinding下拉列表的值时,我的rdCboState文字没有变化。

如何在更改下拉列表时更改文本?

修改:我按照http://www.telerik.com/help/aspnet-ajax/combobox-server-side-selectedindexchanged.html尝试了这样做:

<radcb:radcombobox id="rdCboState" Runat="server" CssClass="Control" height="200" text="--Select--"
    EnableLoadOnDemand="false" width="100" MarkFirstMatch="True" skin="WindowsXP" autopostback="True" OnSelectedIndexChanged="rdCboState_SelectedIndexChanged"></radcb:radcombobox>

而且,我的代码隐藏为:

Protected Sub rdCboState_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
    testBinding.Text = "Test"
End Sub

但是,当我尝试加载页面时出现此错误:

  

编译错误编译器错误消息:BC30408:方法'受保护   Sub rdCboState_SelectedIndexChanged(o As Object,e As   Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)'没有   与代表'Delegate Sub'具有相同的签名   RadComboBoxSelectedIndexChangedEventHandler(o As Object,e As   Telerik.WebControls.RadComboBoxSelectedIndexChangedEventArgs)”

1 个答案:

答案 0 :(得分:0)

我根据错误改变了我的方法签名并且它有效;但是,我的一些控件是隐藏的,但我认为这是一个单独的问题:

Protected Sub rdCboState_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.WebControls.RadComboBoxSelectedIndexChangedEventArgs)