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

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

8 Answers 393 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 07 Jul 2008, 03:45 PM
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.

8 Answers, 1 is accepted

Sort by
0
IrishManInUSA
Top achievements
Rank 1
answered on 08 Jul 2008, 01:24 AM
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.
0
Rosi
Telerik team
answered on 08 Jul 2008, 06:53 AM
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
0
John
Top achievements
Rank 1
answered on 08 Jul 2008, 11:18 AM
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.
0
Rosi
Telerik team
answered on 08 Jul 2008, 01:19 PM
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
0
Steve Roach
Top achievements
Rank 1
answered on 25 Jul 2008, 07:51 AM
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
0
Rosi
Telerik team
answered on 25 Jul 2008, 09:04 AM
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.
0
Sujatha
Top achievements
Rank 1
answered on 08 Feb 2011, 06:16 PM
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
0
Nani
Top achievements
Rank 2
answered on 10 Apr 2013, 04:31 PM
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>
Tags
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
IrishManInUSA
Top achievements
Rank 1
Rosi
Telerik team
John
Top achievements
Rank 1
Steve Roach
Top achievements
Rank 1
Sujatha
Top achievements
Rank 1
Nani
Top achievements
Rank 2
Share this question
or