2 rad comboboxes with the second one dependent on the first one

9 posts, 0 answers
  1. John
    John avatar
    10 posts
    Member since:
    Apr 2008

    Posted 07 Jul 2008 Link to this post

    I am trying to set up a page, where if I select an item from the first dropdown, it will populate the contents of the second one. This is based on the code from this link 

    http://www.telerik.com/demos/aspnet/prometheus/ComboBox/Examples/Functionality/MultipleComboBoxes/DefaultCS.aspx

    This is what I have

    <rad:RadComboBox ID="radDdlOccassion" runat="server" NoWrap="false" LoadingMessage="Loading..." Skin="Vista" Width="210px"

    OnClientSelectedIndexChanged="loadSentiment" OnItemsRequested="radDdlOccassion_ItemsRequested">

    </rad:RadComboBox>

    <br />

    <label class="personalize_label">Sentitment:</label>

    <rad:RadComboBox ID="radDdlSentitment" runat="server" NoWrap="false" LoadingMessage="Loading..." Skin="Vista" Width="210px"

    >

    </rad:RadComboBox>

    Protected Sub radDdlOccassion_ItemsRequested(ByVal o As Object, ByVal e As _radWebUi.RadComboBoxItemsRequestedEventArgs) Handles radDdlOccassion.ItemsRequested

    'Local variables

    'Local constants

    Const cstrPROC_FUNC_NAME As String = _cstrMODULE_NAME & ".radDdlOccassion_ItemsRequested"

    'Try it out

    Try

    LoadSentitment(e.Value)

    Catch ex As Exception

    _strErrMsg &= _ErrorHandler.BuildErrorMsg(cstrPROC_FUNC_NAME, ex.Message & Environment.NewLine & ex.StackTrace)

    Finally

    End Try

    End Sub

    And in my external js file I have the following function

    function

    loadSentiment(combo, eventarqs) {

    var radDdlSentitment = $find("radDdlSentitment");

    var item = eventarqs.get_item();

    radDdlSentitment.set_text(

    "Loading...");

    if (item.get_index() > 0) {

    radDdlSentitment.requestItems(item.get_value(),

    false);

    }

    else {

    radDdlSentitment.set_text(

    " ");

    radDdlSentitment.clearItems();

    }

    }


    I am not getting any js errors, but the itemsrequested event of my first dropdown is not being fired....so any help on this would be appreciated.

  2. IrishManInUSA
    IrishManInUSA avatar
    27 posts
    Member since:
    Jun 2008

    Posted 07 Jul 2008 Link to this post

    I should also add that I am calling this from inside a radwindow, and it looks as though the itemsrequested event is not being fired, but a postback is occurring at all times. Regardless if I have autopostback set to false or not on the controls.

    There is other radcomboboxes on the form that are not causing a postback, so little confused as to what is causing this. I have read some of the articles in this formum to use a Webservice. Would much rather not have to do that, so any ideas on what I can do to fix this would be appreciated. Thanks.
  3. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 08 Jul 2008 Link to this post

    Hi John Daly,

    The problem is that you have attached the radDdlOccassion combo to OnItemsRequested event  but call requestItems method of second combo(radDdlSentitment).

    I suggest you hook the OnItemsRequested="radDdlOccassion_ItemsRequested" to the radDdlSentitment and try it.

    Regards,
    Rosi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. John
    John avatar
    10 posts
    Member since:
    Apr 2008

    Posted 08 Jul 2008 Link to this post

    that is what I thought was happening and made that change before and got the same result, made the same change again in case I messed it up the first time, but again same result.

    So either I am messing it up or it doesn't behave the way I would expect it to, kind of frustrating right now. Because I really want to use this control for this page, and not have to have to rewrite something for dynamic combox, the control works very nicely for what I want and looks pretty good on the page.

    That said, if I don't solve this problem today or tomorrow at the latest, then I will have to rewrite that part of the page to handle what I want. :)


    As I said, I did make the change you suggested and put a break point on the event, and sadly it was never fired. So if you have any ideas on this I would really appreciate it. Thanks.
  5. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 08 Jul 2008 Link to this post

    Hi John,

    We will be happy to help you solve this issue. Please open a support ticket and send us a sample running project illustrating the problem. This will really help us understand the problem better and provide you with more specific instructions.

    Regards,
    Rosi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Steve Roach
    Steve Roach avatar
    2 posts
    Member since:
    Jul 2008

    Posted 25 Jul 2008 Link to this post

    Hello,

    I was wondering if there was an outcome of this request? I too am trying to build a filtered cascading drop down i.e. select a country then a state then a city then a Zip. And I notice that filtering is a new feature so am very curious as to how to implement this.

    Thanks very much

    Tim
  7. Rosi
    Admin
    Rosi avatar
    2529 posts

    Posted 25 Jul 2008 Link to this post

    Hello Steve Roach,

    Please find our online example. Also you can set the Filter property to any of this comboboxes and let us know how this goes.


    Regards,
    Rosi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Sujatha
    Sujatha avatar
    1 posts
    Member since:
    Feb 2011

    Posted 08 Feb 2011 Link to this post

    Hi,
    I followed the online example to cascade RadComboBox and when I try to set the OnItemsRequested to my RadComboBox it complains that I cannot access that because of its protection level. Do you have an alternate for this?

    Thanks
    Suj
  9. 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>
Back to Top