3 Drop downs depending each other

2 posts, 0 answers
  1. Nani
    Nani avatar
    10 posts
    Member since:
    Nov 2011

    Posted 10 Apr 2013 Link to this post

    Here the online solutions depending drop down not vice versa. I have there drop down , data populate using wcf service. Please consider my scenario 
    Step 1 : i am requesting first drop downs  values ( OnClientItemsRequesting="OnClientItemsRequesting" ) i am getting 500 records.
        function OnClientItemsRequesting(sender, e) {
            var context = e.get_context();
            context["UpdateKeys"] = UpdateKeys();// thjis function give 3 dropdown selected value
        }

    Step 2: I am requesting second drop downs values now i am getting 400 records ( these 400 records are depending values on first drop down )
    Step 3: I am requesting third drop downs values now i am getting 300 records ( these 400 records are depending values on first & second drop downs )
    Step 4: Now i am again requesting First drop down values . This time i need to get only 50(which are depending on 2&3 drop downs). i am update getting 50 records when i am start type on drop down text box.
                                But i need to update when i open drop down. Here have client event OnClientDropDownOpening or OnClientDropDownOpened. But this event doesn't have e.get_context(); and all auto wcf calling like OnClientItemsRequesting event.
    <telerik:RadComboBox runat="server" ID="dropdown1" CloseDropDownOnBlur="true" EnableAjaxSkinRendering="true"
            EnableTextSelection="true" ShowWhileLoading="true" EnableLoadOnDemand="true"
           OnClientItemsRequesting="OnClientItemsRequesting"
            ShowMoreResultsBox="true" MinFilterLength="3" EnableVirtualScrolling="true" EmptyMessage="Type refresh values..."
            Width="380" Height="250">
            <WebServiceSettings Path="/Services/service.svc" Method="FillFristDrop" />
        </telerik:RadComboBox>
         <telerik:RadComboBox runat="server" ID="dropdown2" CloseDropDownOnBlur="true" EnableAjaxSkinRendering="true"
            EnableTextSelection="true" ShowWhileLoading="true" EnableLoadOnDemand="true"
           OnClientItemsRequesting="OnClientItemsRequesting"
            ShowMoreResultsBox="true" MinFilterLength="3" EnableVirtualScrolling="true" EmptyMessage="Type refresh values..."
            Width="380" Height="250">
            <WebServiceSettings Path="/Services/service.svc" Method="FillSecondDrop" />
        </telerik:RadComboBox>
         <telerik:RadComboBox runat="server" ID="dropdown3" CloseDropDownOnBlur="true" EnableAjaxSkinRendering="true"
            EnableTextSelection="true" ShowWhileLoading="true" EnableLoadOnDemand="true"
           OnClientItemsRequesting="OnClientItemsRequesting"
            ShowMoreResultsBox="true" MinFilterLength="3" EnableVirtualScrolling="true" EmptyMessage="Type refresh values..."
            Width="380" Height="250">
            <WebServiceSettings Path="/Services/service.svc" Method="FillThirdDrop" />
        </telerik:RadComboBox>
      
      
    <script language="javascript" type="text/javascript">
        function OnClientItemsRequesting(sender, e) {
            var context = e.get_context();
            context["UpdateKeys"] = UpdateKeys();
        }
        function UpdateKeys() {
           return values // return remaing 2 dropdown selected value
        }
    </script>
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 15 Apr 2013 Link to this post

    Hi,

    Try to call first combo's requestItems() method. This will automatically fire OnClientItemsRequesting and you will be able to get e.get_context(); in the same way as you did:
    function OnClientDropDownOpening(sender, args) {
        var firstCombo = $('dropdown1');
        firstCombo.requestItems();
    }

    Regards,
    Hristo Valyavicharski
    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.
Back to Top