我正在尝试在 RadComboBoxItem 中创建复选框组。当单击组 1 时,我希望选择所有组 1,并且组 2 的所有组都被选中,同时选中所有选项。(但是我希望能够设置所有检查的样式,所以我将其设置为一个额外的选项)。So this all works fine, my only issue is that when one option is selected it closes the dropd down... How can i keep it from doing so?
组合框:
EnableAutomaticLoadOnDemand="True" DropDownWidth="380px">
<Items>
<telerik:RadComboBoxItem runat="server" BackColor="Gray" ForeColor="White"
Owner="txtAlertType" Text="Check All" Value="0" />
<telerik:RadComboBoxItem runat="server" Text="Stop Payment Submitted"
Value="13" />
<telerik:RadComboBoxItem runat="server" BackColor="DarkGray" IsSeparator="True"
Owner="txtAlertType" Text="Custom Alerts" Value="0" />
<telerik:RadComboBoxItem runat="server" Text="Login" Value="12" />
<telerik:RadComboBoxItem runat="server" Text="Matures in X Days" Value="1" />
<telerik:RadComboBoxItem runat="server" BackColor="DarkGray" IsSeparator="True"
Owner="txtAlertType" Text="Cash Management" Value="0" />
<telerik:RadComboBoxItem runat="server" Text="Payment Due in X Days"
Value="2" />
<telerik:RadComboBoxItem runat="server" Text="Batch Approved" Value="21" />
<telerik:RadComboBoxItem runat="server" Text="Balance > $" Value="3" />
<telerik:RadComboBoxItem runat="server" Text="Batch Prossed" Value="22" />
<telerik:RadComboBoxItem runat="server" Text="Balance < $" Value="4" />
<telerik:RadComboBoxItem runat="server" Text="Positive Pay Exception"
Value="25" />
<telerik:RadComboBoxItem runat="server" Text="Pending ACH" Value="5" />
<telerik:RadComboBoxItem runat="server" Text="Bank Received Wire > $"
Value="24" />
<telerik:RadComboBoxItem runat="server" Text="Balance Alert" Value="6" />
<telerik:RadComboBoxItem runat="server" Text="Wire Approved" Value="23" />
<telerik:RadComboBoxItem runat="server" Text="Check # Cleared" Value="7" />
<telerik:RadComboBoxItem runat="server" Text="Wire Submitted > $"
Value="26" />
<telerik:RadComboBoxItem runat="server" Text="Deposit > $" Value="8" />
<telerik:RadComboBoxItem runat="server" Text="Wire Transfer Rejected by User"
Value="27" />
<telerik:RadComboBoxItem runat="server" Text="Debit > $" Value="9" />
<telerik:RadComboBoxItem runat="server" Text="Wire Transfer Rejected by Bank"
Value="28" />
<telerik:RadComboBoxItem runat="server" Text="NSF Items Today" Value="10" />
<telerik:RadComboBoxItem runat="server" Text="Wire Transfer Deleted by User"
Value="29" />
<telerik:RadComboBoxItem runat="server"
Text="Online Transaction Processed" Value="11" />
<telerik:RadComboBoxItem runat="server" Text="Wire Transfer Deleted by Bank"
Value="30" />
</Items>
</telerik:RadComboBox>
后面的代码:
Protected Sub OnItemChecked(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)
Select Case e.Item.Text
Case "Check All"
If e.Item.Checked = True Then
For i = 0 To txtAlertType.Items.Count() - 1
txtAlertType.Items(i).Checked = True
Next
Else
For i = 0 To txtAlertType.Items.Count() - 1
txtAlertType.Items(i).Checked = False
Next
End If
Case "Custom Alerts"
If e.Item.Checked = True Then
For i = 0 To txtAlertType.Items.Count() - 1
If txtAlertType.Items(i).value < 14 And txtAlertType.Items(i).value > 0 Then
txtAlertType.Items(i).Checked = True
End If
Next
Else
txtAlertType.Items(0).Checked = False
For i = 0 To txtAlertType.Items.Count() - 1
If txtAlertType.Items(i).value < 14 And txtAlertType.Items(i).value > 0 Then
txtAlertType.Items(i).Checked = False
End If
Next
End If
Case "Cash Management"
If e.Item.Checked = True Then
For i = 0 To txtAlertType.Items.Count() - 1
If txtAlertType.Items(i).value > 15 Then
txtAlertType.Items(i).Checked = True
End If
Next
Else
txtAlertType.Items(0).Checked = False
For i = 15 To txtAlertType.Items.Count() - 1
If txtAlertType.Items(i).value > 15 Then
txtAlertType.Items(i).Checked = True
End If
Next
End If
End Select
End Sub