1

我基于 Telerik 示例编写了以下代码:

<telerik:RadComboBox ID="rcbPageSize"   
runat="Server"   
skin="Gray"  
AllowCustomText="true"  
Style="float:right; margin-left: 5px;"   
Width="60px" 
OnClientTextChange = "PageSizeChanged"
OnClientSelectedIndexChange =  "PageSizeChanged">

<Items>
    <telerik:RadComboBoxItem runat="Server" Text="10" Value="10" />
    <telerik:RadComboBoxItem runat="Server" Text="20" Value="20" Selected="true" />
    <telerik:RadComboBoxItem runat="Server" Text="50" Value="50" />
    <telerik:RadComboBoxItem runat="Server" Text="150" Value="150" />
    <telerik:RadComboBoxItem runat="Server" Text="250" Value="250" />
</Items>

</telerik:RadComboBox>


<telerik:RadCodeBlock ID="rcb" runat="server">

 <script type="text/javascript">

    function PageSizeChanged(sender, eventArgs) {

        alert("You typed " + sender.get_text());

    }

</script>
</telerik:RadCodeBlock>

当我更改选择时,会调用函数“PageSizeChanged”,但是当我通过在组合框中键入来更改文本时,永远不会调用该函数。

任何人有一个建议为什么?谢谢,英巴尔。

4

3 回答 3

1

I find it's definitely a 'feature' of this Telerik control. If you use your code, type something, press enter and then click outside the box the event will fire.

Just pressing enter or just clicking outside don't fire it on their own.

I'm using a slightly newer version of the Telerik controls as the skin Gray has been deprecated but I'm assuming it will be the same in your version.

于 2012-07-18T09:26:06.750 回答
0

OnClientTextChange 不会触发,直到用户按 Enter 键或在 RadComboBox 外部单击。在这里这么说:http ://www.telerik.com/help/aspnet-ajax/combobox-onclienttextchange.html

于 2012-07-08T23:37:44.483 回答
-1

您必须设置 AutoPostBack="true",才能触发服务器事件。

<telerik:RadComboBox ID="rcbPageSize"  
AutoPostBack="true" 
runat="Server"   
skin="Gray"  
AllowCustomText="true"  
Style="float:right; margin-left: 5px;"   
Width="60px" 
OnClientTextChange = "PageSizeChanged"
OnClientSelectedIndexChange =  "PageSizeChanged">
于 2013-02-14T08:43:10.770 回答