RadCombo With Editable Textbox as first Item

4 posts, 0 answers
  1. Jayavidya
    Jayavidya avatar
    14 posts
    Member since:
    Oct 2010

    Posted 22 Oct 2010 Link to this post

    Hello,
        I am looking for a combo box with a textbox as first item so that user can enter a text and then click on the dropdown to select a search kind ex. Starts with Ends With. This is a search condition attached to the RadGrid. Please refer to the following code. The search condition also has excel like advanced filter. Is it possible to make the first Item in the RadMenu - "All" to a editable mode?
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true" AutoGenerateColumns="false"
                       GridLines="None" Width="95%" AllowPaging="true" PageSize="25" OnNeedDataSource="RadGrid1_NeedDataSource">
                       <MasterTableView Width="100%" DataKeyNames="City" AllowFilteringByColumn="true" FilterItemStyle-Width="100%">
                           <Columns>
                               <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City">
                                   <FilterTemplate>
                                       <telerik:RadComboBox ID="RadSearchComboBox" Height="60px" AppendDataBoundItems="true"
                                           AutoPostBack="true" Text="" runat="server" OnSelectedIndexChanged="FilterCombo_SelectedIndexChanged"
                                           OnClientSelectedIndexChanged="SelectedIndexChanged" ShowDropDownOnTextboxClick="true">
                                           <Items>
                                               <telerik:RadComboBoxItem Text="All" Value="All" Style="display: none;" />
                                               <telerik:RadComboBoxItem Text="Chennai" Value="Chennai"/>
                                               <telerik:RadComboBoxItem Text="Hyderabad" Value="Hyderabad" />
                                           </Items>
                                           <HeaderTemplate>
                                              <telerik:RadMenu runat="server" ID="radM" Flow="Vertical" >
                                              <Items>
                                               <telerik:RadMenuItem Text="Select Filter">
                                                   <Items>
                                                       <telerik:RadMenuItem Text="Starts With" Value="SW"></telerik:RadMenuItem>
                                                       <telerik:RadMenuItem Text="Ends With" Value="EW"></telerik:RadMenuItem>
                                                   </Items>
                                               </telerik:RadMenuItem>
                                              </Items>
                                              </telerik:RadMenu>
                                           </HeaderTemplate>
                                           <ItemTemplate>
                                               <asp:CheckBox runat="server" ID="CheckBox" onclick="stopPropagation(event);" Text="">
                                               </asp:CheckBox>
                                               <asp:Label ID="lbl" runat="server" Text='<%# DataBinder.Eval(Container, "Text") %>'></asp:Label>
                                           </ItemTemplate>
                                       </telerik:RadComboBox>
                                   </FilterTemplate>
                               </telerik:GridBoundColumn>
                           </Columns>
                       </MasterTableView>
                       <PagerStyle Mode="NextPrevAndNumeric" />
                   </telerik:RadGrid>
    Thanks,
    JJ
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Oct 2010 Link to this post

    Hello,


    If you want to add textbox control as first item in combo, then use the following code.

    Code:
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem filteringItem = (GridFilteringItem)e.Item;
            RadComboBox filterCombo = (RadComboBox)filteringItem.FindControl("RadSearchComboBox");
            filterCombo.Items[0].Controls.Clear();
            TextBox textBox = new TextBox();
            filterCombo.Items[0].Controls.Add(textBox);
        }
    }



    -Shinu.
  3. Jayavidya
    Jayavidya avatar
    14 posts
    Member since:
    Oct 2010

    Posted 22 Oct 2010 Link to this post

    Hello,
    Thanks for the response. I didnt get the solution I wanted by adding textbox in the ItemCreated Event.
    I am trying to implement something like the excel 2007 filter as shown in the attached ExcelFilter.png. I want a RadGrid with a textbox and a dropdown. My sample grid 'excellikesearch.png' attached here with.
    1. When user enters the text and clicks on the dropdown the user can select filtering types like 'Starts With', 'Ends With' etc and query the details
    2. Or when the user clicks on the dropdown to select any unique value and checks one or more values the results should be queried.

    If you look at the 'excellikesearch.png' image, the 'All' if set to some editable mode, I feel I can achieve the excel filter mechanism,

    Please advice me. 

    Thanks,
    JJ 
  4. Jayavidya
    Jayavidya avatar
    14 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2010 Link to this post

    Hello, 
        
    Is this editable function possible in radcombo?

    Thanks,
    JJ.
Back to Top