(The title of this thread is not quite accurate. The title should be: "A RadComboBox event SelectedIndexChanged fires when the control is programmatically checked with exactly one checkbox item")
I have a RadComboBox that contains CheckBox items. I programmatically set certain items as Checked, if data exists in a database table. Here is a segment of code:
Here is the aspx snippet:
What I would like to do is create code such that when my programmatic method changes the index (which appears only to occur when only ONE items is check-marked, but never when zero, or two or more, items are check-marked by the program), that I can somehow set the SelectedIndex code to ignore it, but when the USER MAKES A CHANGE, then I pay attention to it. Should I create an internal variable "flag" in my program to somehow watch for when I make changes programmatically, but clear the flag? This seems clunky.
Any guidance would be appreciated. Thank you.
I have a RadComboBox that contains CheckBox items. I programmatically set certain items as Checked, if data exists in a database table. Here is a segment of code:
Dim idr As Data.DataRowDim ids As Data.DataSet Dim idt As Data.DataTableDim idtData As New Data.DataSet Dim iParameters(0 To 0) As Data.SqlClient.SqlParameteriParameters(0) = New Data.SqlClient.SqlParameter("@intBIDOID", CheckDBNull(CInt(BIDOID), enumObjectType.IntType)) ids = clsEPD_DATA.StoredGetDataset("spGetBidsSystemTypeNames", iParameters) If ids.Tables(0).Rows.Count >= 1 Then idt = ids.Tables(0) For Each idr In idt.Rows ' "BUG" - when one and ONLY one item is check-marked, here, it causes the control to ' be in a state as if SelectedIndex has been changed (Telerik states this is expected). ' And, it stays that way, even though we set it here, and the user did NOT change anything. ' This is a "bug" in our scenario, where I must determine if the USER DID THE CHANGE, ' not the program. Dim cboSTObject As RadComboBoxItem = cboSystemType.FindItemByValue(CheckDBNull(idr("SYSTOID"), enumObjectType.IntType)) cboSTObject.Checked = True cboSTObject.Dispose() Next ids.Dispose() End If '------------ end of System Type checkboxed combobox ----------------------Here is the aspx snippet:
<telerik:RadComboBox ID="cboSystemType" runat="server" Width="200px"EmptyMessage="Select the System Type (if any):"Height="250px" DataTextField="ST_Name" DataValueField="SYSTOID"DataSourceID="SqlDataSource5" TabIndex="8" CheckBoxes="True"CausesValidation="False"></telerik:RadComboBox><br/><asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:EPD_DATAConnectionString %>"SelectCommand="spGetBidSystemTypeNames" SelectCommandType="StoredProcedure"></asp:SqlDataSource>What I would like to do is create code such that when my programmatic method changes the index (which appears only to occur when only ONE items is check-marked, but never when zero, or two or more, items are check-marked by the program), that I can somehow set the SelectedIndex code to ignore it, but when the USER MAKES A CHANGE, then I pay attention to it. Should I create an internal variable "flag" in my program to somehow watch for when I make changes programmatically, but clear the flag? This seems clunky.
Any guidance would be appreciated. Thank you.