This is a migrated thread and some comments may be shown as answers.

I can't get CheckedItems from radcombobox which binded by web services

8 Answers 422 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gökhan
Top achievements
Rank 1
Gökhan asked on 10 Oct 2011, 04:03 PM
I have a RadCombobox and I use webservice datasource. Combobox could bind data and it show checkbox items.

When I click save button, I couldn't get combobox checkeditems collection. My code is here;

<telerik:RadComboBox ID="cmbNotificationUsers" runat="server" CheckBoxes="true" EnableCheckAllItemsCheckBox="true" Width="100%" OnClientItemsRequesting="OnClientItemsRequestingForUser"
                            EmptyMessage="Select" MarkFirstMatch="true" EnableLoadOnDemand="true">       
                            <WebServiceSettings Path="../../WebServices/ControlObjects/ComboBoxes.asmx" Method="GetUsersByCompany" />
                        </telerik:RadComboBox>

foreach (Telerik.Web.UI.RadComboBoxItem item in cmbNotificationUsers.CheckedItems)
            {
                messageUsers.Add(item.Value);
            }

Thanks,
Gökhan

8 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 11 Oct 2011, 03:43 PM
Hi Gökhan,

Since you are using the load on demand mechanism to populate the RadComboBox with data, the items of the RadComboBox are not persisted and therefore could not be accessed in code-behind.
For more information about this scenario you could refer to the following help articles on our website:
ComboBox items are not accessible on server-side when loading them on demand and  Load On Demand Overview.

In addition, if you really need to implement the scenario in question, you can store the text and the value of the selected items in a hidden field as a value:text pair and then get the value of the hidden field on the server. To get the value and the text of a selected item you could subscribe to the OnClientItemChecked client-side event of the RadComboBox. Even in that case you will not have the real instance of the items but only its text and its value.

Greetings,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
salih
Top achievements
Rank 1
answered on 24 Apr 2012, 03:09 PM
Selam Gökhan;
Sende galiba combobox ı doldururken onitemsrequested event ını kullandın ve chekbox daki seçili olan değerlerin valularını alamadın yani sendede checkeditems in count 0 geliyor bu sorunu nasıl bir yöntem ile hallettin 
0
Aman
Top achievements
Rank 1
answered on 28 Jan 2015, 03:27 AM
I tried to store value in hidden field on each OnClientItemChecked(client side). I added alert to check  the hiddenvalue and It is updated each time but when moving to another variable in behind code(server side), the hidden field value is empty. What should be done to save the hidden value from getting cleared ?
Thanks in Advance.
0
Nencho
Telerik team
answered on 30 Jan 2015, 07:52 AM
Hello Aman,

Could you please provide us with the implementation that you use at your end, so we could inspect it locally and try to pinpoint the problem for you?

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Aman
Top achievements
Rank 1
answered on 30 Jan 2015, 05:31 PM
Hidden field one is worked. Now for the same scenerio,I have questions:
1) OnClientCheckAllChecked doesnot work and if I select all , it picks the first value because of OnItem Checked.
2) What to do if I uncheck the item. or uncheck and check it again, as data is stored in hidden field. 
If hidden field has data as "USA;Russia;Spain" .I uncheck Russia, then also hidden field will have same data.
And If I again check it , data will be "USA;Russia;Spain;Russia'
Can you tell me the controls that work with multiselect radcombobox which binded by web services
0
Nencho
Telerik team
answered on 04 Feb 2015, 09:52 AM
Hello Aman,

The issue that you experienced in the first of your questions is probably related with an unexpected behavior in such scenario. Using the Checkboxes along with the LoadOnDemand mechanism enabled is not a supported scenario, which is stated in the following documentation article:

http://www.telerik.com/help/aspnet-ajax/combobox-usability-checkboxes.html

As for your other question - generally, you can verify if the current operation on the item is check or uncheck and verify if the text of the item is contained in the value of the hidden field using indexof(). And regarding the current operation, you can remove it or add the Item's text.

Regards,
Nencho
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Aman
Top achievements
Rank 1
answered on 20 Mar 2015, 09:43 PM
Hello,

I have an issue with marhfirstmatch="true" with CheckedItems radcombobox which binded by web services.
It is not working. How to resolve it ?
0
Aman
Top achievements
Rank 1
answered on 07 Apr 2015, 03:14 PM

Hi!

I am still looking for a way to search items in Multi select radcombobox that has data binding with web services.

I tried Autocomplete and filtering too.

Autocomplete doesnot work.

Filtering works but every time when I retype to find another text, combobox get refreshed and not able to save earlier checked items.

Below is the code that I am using.

Thanks in Advance.

<asp:Panel ID="Pnl1" runat="server" Visible="false">
<telerik:RadComboBox ID="ddl1" CheckBoxes="true" runat="server" width="200" Height="150px" DropDownWidth="200"
EmptyMessage="Select" EnableLoadOnDemand="true" ShowMoreResultsBox="true"
AllowCustomText="true" Filter="Contains" EnableVirtualScrolling="true" Enabled="false"
OnClientItemsRequesting="OnClientItemsRequesting"
OnClientItemChecked = "OnClientItemChecked_Mul"

>
<WebServiceSettings Path="~/Services/Control.asmx" Method="GetListMultiple" />
</telerik:RadComboBox>
</asp:Panel>

Tags
ComboBox
Asked by
Gökhan
Top achievements
Rank 1
Answers by
Ivana
Telerik team
salih
Top achievements
Rank 1
Aman
Top achievements
Rank 1
Nencho
Telerik team
Share this question
or