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

9 posts, 0 answers
  1. Gökhan
    Gökhan avatar
    11 posts
    Member since:
    Jun 2011

    Posted 10 Oct 2011 Link to this post

    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
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 11 Oct 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. salih
    salih avatar
    9 posts
    Member since:
    Feb 2008

    Posted 24 Apr 2012 Link to this post

    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 
  5. Aman
    Aman avatar
    4 posts
    Member since:
    Jan 2015

    Posted 27 Jan 2015 in reply to Ivana Link to this post

    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.
  6. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 30 Jan 2015 Link to this post

    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.

     
  7. Aman
    Aman avatar
    4 posts
    Member since:
    Jan 2015

    Posted 30 Jan 2015 Link to this post

    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
  8. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 04 Feb 2015 Link to this post

    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.

     
  9. Aman
    Aman avatar
    4 posts
    Member since:
    Jan 2015

    Posted 20 Mar 2015 Link to this post

    Hello,

    I have an issue with marhfirstmatch="true" with CheckedItems radcombobox which binded by web services.
    It is not working. How to resolve it ?
  10. Aman
    Aman avatar
    4 posts
    Member since:
    Jan 2015

    Posted 07 Apr 2015 Link to this post

    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>

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017