Good morning,
I have two cells that have to be setup with a dropdown list of items with the checkbox selection feature.
To allow user to make multiple selections for the item.
It appears to work great. Both have their selection lists and the checkboxes next to them.
The thing is the first list only shows one item, the first in the checked off list, as checked off.
Even though the items appear in the list as checked off.
The second list works perfectly fine and shows the number of items checked off.
Both use the same code to set themselves up and to read back what was selected.
So why does the first one only show one item checked off when there is more then one actually checked off?
Hope that explains things. Code below.
Under the grids InitializeRow sub:
objDDL = objTools.DBuwEdComboInit(objDDL, (strSQLIs), strWhoAmI, msUserName, strConnStrToUse)
Dim objTool As Infragistics.Win.UltraWinToolbars.ComboBoxToolobjTool = uwTBMgr.Ribbon.Tabs("Home").Groups("Home - Available Reports").Tools("Reports")Select Case objTool.Text Case "Order List Details" With objDDL .AutoCompleteMode = Infragistics.Win.AutoCompleteMode.Suggest .SortStyle = Infragistics.Win.ValueListSortStyle.Ascending .DropDownStyle = Infragistics.Win.DropDownStyle.DropDown Dim intVisItemcount As Integer = objDDL.Items.Count If (intVisItemcount > 100) Then intVisItemcount = 100 End If .MaxDropDownItems = intVisItemcount .CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox End With Case Else End Select e.Row.Cells("Value/Choices").EditorComponent = objDDL
And when I am reading back the items checked off,
-- 2nd Cell read back, on the next rowDim intItemsSelected As Integer = DirectCast(uwGrid_RptFilters.Rows(intFilterOn).Cells("Value/Choices").EditorComponent, Infragistics.Win.UltraWinEditors.UltraComboEditor).CheckedItems.CountIf (intItemsSelected > 0) Then Dim intItemsIDX As Integer = 0 While (intItemsIDX < intItemsSelected) strItemIs = DirectCast(uwGrid_RptFilters.Rows(intFilterOn).Cells("Value/Choices").EditorComponent, Infragistics.Win.UltraWinEditors.UltraComboEditor).CheckedItems(intItemsIDX).DisplayText msFilters(3) = msFilters(3) & "''" & strItemIs & "'', " intItemsIDX += 1 End While 'check for last COMA strItemIs = msFilters(3) strItemIs = StrReverse(StrReverse(strItemIs).Substring(2, (StrReverse(strItemIs).Length - 2))) msFilters(3) = strItemIsElse msFilters(3) = .Rows(intFilterOn).Cells("Value/Choices").Text Select Case msFilters(3) Case "", "--- Choose One ---" msFilters(3) = "" Case Else msFilters(3) = " ''" & msFilters(3) & "'' " End SelectEnd If
Hello Deasun,
Thanks for attached sample. I was able to reproduce your issue and after few hours of debuging, I`d like to inform you that mentioned issue is cause from the custom code. I was confuse from your scanrio where you are using InitializeRow event and override the selection from the drop down list. Just for example there are code:
e.Row.Cells("Value/Choices").Value = e.Row.Cells("InitValue").Text
Maybe you know that this event fired when row is initialized at the beggining and after each modification of the data in that row. By this way you always override the selection from your dropdown list
Also, I didn`t find where you set the mandatory properties for multiple selection like:
ultraComboEditor1.CheckedListSettings.CheckBoxStyle = CheckStyle.CheckBox;
ultraComboEditor1.CheckedListSettings.ItemCheckArea = ItemCheckArea.CheckBox;
ultraComboEditor1.CheckedListSettings.ListSeparator = ", ";
ultraComboEditor1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems;
Please note that without these settings you are not able to show in the grid`s cell, your selected dropdown items. That`s why, nevertheless of your selection in the drop down list, your grid`s cell will show only one item. So when you press "Read Filters" button you will get items count = 1, because the grid`s cell contains only one item. If you want to get correct item`s count of selected items, you should apply these properties. The grid`s cell should display each selected item from drop down menu with desired list separator.
Please choose one of the possible options to apply items to your UltraComboEditor. You could use DataSource or Items collection, but in both scenarios you should apply the properties above.
I`m not sure, but maybe there are a bug (in the sample), because nevertheless which item is choose from the drop down list, the grid`s cell alway shows the first item. Is it expected behavior ?
Please take a look at the attached video file for more information and let me know if you have any further questions.
PS. We realy will appreciate, if you create a simple sample next time. This will save our time for research and response. The same scenario could be reproduce it without database and half of the code in the sample.
Thanks and Regards
Did you restore the SQL Backup file to your local MS SQL server?
Then change the Connection string in the config file. named: Cstr_ToUse
Server name, User name & password.
It should work then for you.
I double checked the last project copy on a clean pc here and it works fine.
Yes the individual items have their checked state changed.
Its the Checkitems count property that is not being updated. It remain at a count of 1.
No matter how many you have actaully checked off.
Click begin to fill in the grid from the backup SQL DB.
Set the drop down for the 2nd and 3rd filter rows to whatever checked items you want.
Then click the Read check items btn. That will then attempt to rpt what the Checkeditems.count is returning in the two labels below the btn.
The project is about as simple as I can make it. :(
I have gotten around my problem by now looping thru the dropdown controls items and checking the checked state for each. Just a nusance, and would like to know why that property is not working.
Thanks for your replies.
Deasun.
Hello tirnaog,
So you are saying that the individual items property is changing from checked to not checked but the collection CheckedItems is not changing? I again cannot run your project, when I click on Begin the application just freezes. I am wondering if you could provide a simpler application without any extra code or functionality. I tried it on my own again and cannot reproduce this behavior.
Being playing around with the test project.
It still shows only 1 item is checked, but on checking the items individually,
I find the items are telling me which is checked and which is not.
I would have to loop thru each to find my checked items.
So whats not working is the;
DirectCast(uwGrid_RptFilters.Rows(intFilterOn).Cells("Value/Choices").EditorComponent, Infragistics.Win.UltraWinEditors.UltraComboEditor).CheckedItems.Count
Anyone any ideas?