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

related comboboxes

1 Answer 42 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Anjali
Top achievements
Rank 1
Anjali asked on 12 Jul 2011, 07:23 PM
Hi All,

  I am following the example of the related comboxes.
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

 I have two related comboboxes and an add button Once the user selected from both the radComboBox_filters and radCombox_E comboxes, he can add the selection to the listbox RadListBox_EFilters on the right side.

My problem is that radComboBox_filters does not display "Select filters" at the top of the comboxBox because I want to display "select filters" at the top of the combox. Also, If I select something from the RadCombobox_filters, the radCombox_E will be populated with data. Once I select something from the radcombox_e and click the add button, radCombox_E gets cleared out. I don't want the radCombox_E to be cleared out just becasue I clicked on add button.
How can I fix that because I don't want the readCombox_e to be cleared out once i push the add button. Below is my code.
<script type="text/javascript">
    var ECombo;
     
function pageLoad() {
      
    ECombo = $find('<%= RadPanelBar1.Items[0].Items[0].FindControl("RadComboBox_E").ClientID %>');
  
}
  
function RadComboBox_E_Load(combo, eventArgs) {
  
    var item = eventArgs.get_item();
  
    ECombo.set_text("Loading...");    
    if (item.get_index() > 0) {
  
       ECombo.requestItems(item.get_textElement().innerText, false);
    }
    else {
        ECombo.set_text(" ");
        ECombo.clearItems();
  
    }
}
function ItemsLoaded(combo, eventArqs) {
     
    if (combo.get_items().get_count() > 0) {
        // pre-select the first item
        combo.set_text(combo.get_items().getItem(0).get_text());
        combo.get_items().getItem(0).highlight();
    }
    combo.showDropDown();
}
  
  
  
</script>
  
<telerik:RadPanelBar ID="RadPanelBar1" runat="server" Width="1500px" BackColor="#E6E6E6" ExpandMode="MultipleExpandedItems">
            <Items>
                <telerik:RadPanelItem runat="server" Text="Filters" Expanded="true">
                    <items>
                        <telerik:RadPanelItem Text="">
                            <ItemTemplate>
                                <table width="20%" cellpadding="0" cellspacing="0">
    <tr>
        <td style="width:10%">
        Filters:
         <telerik:RadComboBox ID="RadComboBox_filters" 
                runat="server" 
                Width="200px" 
                  
                OnClientSelectedIndexChanging="RadComboBox_E_Load" 
                onitemsrequested="RadComboBox_filters_ItemsRequested" EmptyMessage="Select Filters" HighlightTemplatedItems="true" Filter="StartsWith"></telerik:RadComboBox>
  
          </td>
          <td> </td>
          <td style="width:10%">
           E:
            <telerik:RadComboBox ID="RadComboBox_E" 
                runat="server" 
                ClientIDMode="Static"
                Width="200px" 
               OnClientItemsRequested="ItemsLoaded" onitemsrequested="RadComboBox_E_ItemsRequested" MarkFirstMatch="true" EmptyMessage="Please Select.."/>
        </td>
        <td> </td>
         <td> </td>
          <td> </td>
        <td style="width:10%"><br />
                <telerik:RadButton ID="RadButton_Add" runat="server" Text="Add" 
                       onclick="RadButton_Add_Click">
                        <Icon SecondaryIconCssClass="rbAdd" SecondaryIconRight="4" SecondaryIconTop="4" />
                    </telerik:RadButton>
          
        </td>
        <td style="width:10%">
             <telerik:RadListBox runat="server" ID="RadListBox_EFilters"  AutoPostBack="false"
                    SelectionMode="Single" Width="600px" Height="200px" AllowDelete="true">
                    </telerik:RadListBox>
        </td>
        <td style="width:80%"> </td>
      
    </tr>
  
  
</table>
  
  
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </items>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>

Any help will be appreciated.

1 Answer, 1 is accepted

Sort by
0
Anjali
Top achievements
Rank 1
answered on 12 Jul 2011, 09:20 PM
Tags
ComboBox
Asked by
Anjali
Top achievements
Rank 1
Answers by
Anjali
Top achievements
Rank 1
Share this question
or