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

RadCombo With Editable Textbox as first Item

3 Answers 101 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jayavidya
Top achievements
Rank 1
Jayavidya asked on 22 Oct 2010, 08:46 AM
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

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Oct 2010, 10:20 AM
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.
0
Jayavidya
Top achievements
Rank 1
answered on 22 Oct 2010, 10:42 AM
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 
0
Jayavidya
Top achievements
Rank 1
answered on 27 Oct 2010, 02:35 PM
Hello, 
    
Is this editable function possible in radcombo?

Thanks,
JJ.
Tags
ComboBox
Asked by
Jayavidya
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jayavidya
Top achievements
Rank 1
Share this question
or