我创建了带有复选框列表的 radcombobox。用户可以选择多个复选框,并且当他检查页面上的某些项目标签时必须更新(this.label.text += someValue)。我在该 radcombobox 上添加了带有异步触发器的 Ajax:UpdatePanel 但问题是当用户检查项目下拉列表时自行关闭它:( 如何防止关闭下拉列表?这是我尝试过的:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<telerik:RadComboBox runat="server" ID="rcb" Width="200px" HighlightTemplatedItems="true"
AllowCustomText="true" Text="Select Item" MaxHeight="250px" EnableTextSelection="false" AutoPostBack="true"
OnClientSelectedIndexChanging="OnClientSelectedIndexChanging()">
<Items>
<telerik:RadComboBoxItem Value="0" Text="Select..." />
<telerik:RadComboBoxItem Value="1" Text="Small" />
<telerik:RadComboBoxItem Value="2" Text="Medium" />
<telerik:RadComboBoxItem Value="3" Text="Large" />
</Items>
<ItemTemplate>
<asp:CheckBox onclick="stopPropagation(event);" ID="chk_Category" runat="server" Text="test" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
</ItemTemplate>
</telerik:RadComboBox>
<dnn:label ID="lbl" runat="server" Text="nothing" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rcb"/>
</Triggers>
</asp:UpdatePanel>
<script type="text/javascript" language="javascript">
// <![CDATA[
function stopPropagation(e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
}
function OnClientSelectedIndexChanging(item) {
return false;
}
// ]]>
</script>