related comboboxes

2 posts, 0 answers
  1. Anjali
    Anjali avatar
    101 posts
    Member since:
    Dec 2010

    Posted 12 Jul 2011 Link to this post

    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.

  2. Anjali
    Anjali avatar
    101 posts
    Member since:
    Dec 2010
Back to Top