This is a migrated thread and some comments may be shown as answers.
Send both selectedText & Value to requestItems event
2 Answers 29 Views
This is a migrated thread and some comments may be shown as answers.
Naunton
Top achievements
Rank 1
Naunton asked on 19 Jan 2011, 04:50 AM
Hi all,
Please advise.
After selected 1stCombo, then bind 2ndCombo base on 1stCombo selected value & text.
Thant's why I need to send both selectedText & Value from ClientScript at ClientSelectedIndexChange.

My code is as below
<telerik:RadComboBox ID="Cbo1" runat="server"
        CssClass="label" Label="Combox1     :" Skin="WebBlue"
        OnClientSelectedIndexChanging="LoadCbo2l"
            OnItemsRequested="Cbo1_ItemsRequested"
            onclientitemsrequested="ItemsLoaded" ViewStateMode="Enabled"
                ></telerik:RadComboBox>
 
<telerik:RadComboBox ID="Cbo2" Runat="server" CssClass="label" Label= "Combox2 :"
            Skin="WebBlue" OnItemsRequested="Cbo2_ItemsRequested"
            OnClientItemsRequested="ItemsLoaded" ViewStateMode="Enabled">
        </telerik:RadComboBox>
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
     <script type="text/javascript">
 
function LoadCbo2(combo, eventArqs) {
    var 2ndCombo;
             var item = eventArqs.get_item();
             2ndCombo.set_text("Loading...");
  
             if (item.get_index() > 0) {
                      Cbo2.requestItems(item.get_value(), false);
             }
             else {
                 2ndCombo.set_text(" ");
                 2ndCombo.clearItems();
             }
         }
        </script>
</telerik:RadCodeBlock>

With this I only get selected value at Cbo2_ItemsRequested event, when I try to get with  Cbo1.SelectedItem.Text  directly, the text I selected is not yet there.
How can I get both, please?

Thanks and best regards

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 19 Jan 2011, 05:55 AM
Hello Naunt,

If you want to get the selected text of RadComboBox in 'OnClientSelectedIndexChanging' event, you can try the following code snippet.

Java Script:
<script type="text/javascript">
 function LoadCbo21(combo, eventArqs) {
    var item = eventArqs.get_item();
    alert(item.get_text()); //getting selected text
 </script>

Thanks,
Princy.
0
Naunton
Top achievements
Rank 1
answered on 19 Jan 2011, 06:41 AM
Hi Princy,

Thanks for your very fast reply.
I want both text and value.
Now I change as below, then I'm going to Split() at codebehind.
VslCombo.requestItems(item.get_text() + "_" + item.get_value(), false);


Thanks and best regards
Asked by
Naunton
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Naunton
Top achievements
Rank 1
Share this question
or