SelectedValue is empty - RadComboBox and EnableLoadOnDemand=false

7 posts, 0 answers
  1. Dominic
    Dominic avatar
    30 posts
    Member since:
    Apr 2009

    Posted 04 Jun 2009 Link to this post

    Hello,

    i use the RadComboBox with LoadOnDemand. In my Javascript code i'm calling comboBox.requestItems(...) to fill the RadComboBox. The EnableLoadOnDemand property ist set to false (there is no option for true in my workflow). After a postback, the SelectedValue is always empty. If i set EnableLoadOnDemand to true, the SelectedValue will be set (but this is no option for me). Is there a solution for this problem?

    Best Regards

  2. cs137
    cs137 avatar
    5 posts
    Member since:
    Nov 2009

    Posted 10 Jun 2010 Link to this post

    Hello,

    I have the same issue. On page load i add to combobox some default item so user will see some already selected value. Then I call items loading via WS manually in JS and do not use EnableLoadOnDemand option in order to leave combobox in ready only mode. But on postback RadCombobox control doesn't handle data posted  from client side (received data is correct - according to user selection) and leaves item was added on page load selected (only control Text property is changed correctly).

    ASPX:
       <telerik:RadScriptBlock runat="server"
            <script type="text/javascript"
                function OnCountriesDropdownOpened<%= ClientID %>(sender, eventArgs) 
                { 
                    $find('<%= ddlClientCountry.ClientID %>').requestItems('', false); 
                } 
     
            </script> 
        </telerik:RadScriptBlock> 
         
        <telerik:radcombobox id="ddlClientCountry"   
                Runat="server"   
                CollapseDelay="0"   
                ExpandDelay="0"  
                ShowDropDownOnTextboxClick="true"
                Height="350" >  
                <WebServiceSettings Method="GetCountries" Path="../../WebServices/PhoneNumberService.asmx" />  
            <expandanimation duration="0" type="None"></expandanimation>  
            <collapseanimation duration="0" type="None"></collapseanimation>  
               
        </telerik:radcombobox>   

    C#:
            protected void Page_Load(object sender, EventArgs e) 
            { 
     
                ddlClientCountry.OnClientDropDownOpened = "OnCountriesDropdownOpened" + ClientID; 
                 
                ... 
            }    

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kyle Butler
    Kyle Butler avatar
    26 posts
    Member since:
    Jun 2008

    Posted 11 Jun 2010 Link to this post

    Dominic, is your MarkFirstMatch property set to true? If so, set it to false. This is a bug in the control.
  5. Kyle Butler
    Kyle Butler avatar
    26 posts
    Member since:
    Jun 2008

    Posted 11 Jun 2010 Link to this post

    Dominic, is your MarkFirstMatch property set to true? If so, set it to false. This is a bug in the control.
  6. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 14 Jun 2010 Link to this post

    Hello Stepan Melnichuk,

    Let me suggest you set the AllowCustomText property of the radComboBoxStateProvince  to "true".
    Then if you prefer to restrict user typing in the RadComboBox input  - handle the OnClientLoad event of the radComboBoxStateProvince as shown below:

    function OnClientLoadHandler(sender)
    {
        sender.get_inputDomElement().readOnly = "readonly";
    }

    If the issue persists - could you please paste here the full code of your implementation?

    All the best,
    Kalina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  7. cs137
    cs137 avatar
    5 posts
    Member since:
    Nov 2009

    Posted 15 Jun 2010 Link to this post

    I fixed it by handling OnClientSelectedIndexChanged and doing the following:

           function Client_indexChanged(sender, eventArgs) 
            { 
                //checking for avoid cycle 
                if(sender.get_items().get_count()>1) 
                { 
                    var item = eventArgs.get_item(); 
                    var value = item.get_value(); 
                    var text = item.get_text(); 
                         
                    sender.clearItems(); 
                    sender.clearSelection(); 
     
                    var comboItem = new Telerik.Web.UI.RadComboBoxItem(); 
                    comboItem.set_text(text); 
                    comboItem.set_value(value); 
                         
                    sender.trackChanges(); 
                    sender.get_items().add(comboItem); 
                    comboItem.select(); 
                    sender.commitChanges();   
                } 

  8. Clarence
    Clarence avatar
    9 posts
    Member since:
    Nov 2008

    Posted 08 Jul 2010 Link to this post

    Stephan, thanks for the code.  I've modified it so that the value can be set when only one item is selected.

    function OnClientSelectedIndexChanged(sender, eventArgs) {
        var item = eventArgs.get_item();
        var value = item.get_value();
        var text = item.get_text();
        var itemCount = sender.get_items().get_count();
        if (itemCount > 1) {
            sender.clearItems();
            sender.clearSelection();
            var comboItem = new Telerik.Web.UI.RadComboBoxItem();
            comboItem.set_text(text);
            comboItem.set_value(value);
            sender.trackChanges();
            sender.get_items().add(comboItem);
            comboItem.select();
            sender.commitChanges();
        }
        if (itemCount = 1) {
            sender.trackChanges();
            sender.set_text(text);
            sender.set_value(value);
            sender.commitChanges();
        }
    }
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017