How to add autocomplete textbox inside radgrid?

5 posts, 1 answers
  1. Coolbudy
    Coolbudy avatar
    24 posts
    Member since:
    Nov 2012

    Posted 20 Nov 2012 Link to this post

    how we can add autocontemplate Textbox at header part of radgrid?
  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Nov 2012 Link to this post

    Hi,

    I suppose you want to add an AutoComplete TextBox in the RadGrid header. Please take a look into the following code snippet to add a TextBox in the header of a column.

    C#:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
            if (e.Item is GridHeaderItem)
            {
                GridHeaderItem headerItem = (GridHeaderItem)e.Item;
                TextBox TextBox1 = new TextBox();
                TextBox1.ID = "TextBox1";
                TextBox1.AutoCompleteType = AutoCompleteType.Email;
                headerItem["OrderID"].Controls.Add(TextBox1); //TextBox is added to OrderID column header 
            }
    }

    Please elaborate your scenario if it doesn't help.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Coolbudy
    Coolbudy avatar
    24 posts
    Member since:
    Nov 2012

    Posted 20 Nov 2012 Link to this post

    Thanks budy its works but i have one query is that i apply also filtering at my header template is
    Is that possible to apply both filtering and autocomlete at one header template
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Nov 2012 Link to this post

    Hi,

    I suppose you want to filter Radgrid with TextBox. One suggestion is that you can use the FilterTemplate as shown below.
    aspx:
    <telerik:GridBoundColumn DataField="OrderID"  HeaderText="Name"  UniqueName="OrderID">
      <FilterTemplate>
         <telerik:RadTextBox  AutoPostBack="true" ID="RadTextBox1" runat="server"  ontextchanged="RadTextBox1_TextChanged"></telerik:RadTextBox>
      </FilterTemplate>
    </telerik:GridBoundColumn>
    C#:
    protected void RadTextBox1_TextChanged(object sender, EventArgs e)
    {
        RadTextBox txt = (RadTextBox)sender;
        RadGrid1.MasterTableView.FilterExpression = "([OrderID] = " + txt.Text+ ")";
        RadGrid1.MasterTableView.GetColumn("OrderID").CurrentFilterFunction = GridKnownFunction.EqualTo;
        RadGrid1.MasterTableView.GetColumn("OrderID").CurrentFilterValue = txt.Text;
        RadGrid1.MasterTableView.Rebind();
    }

    Thanks,
    Shinu.
  6. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 12 Mar 2015 in reply to Shinu Link to this post

    Hi Shinu,

    I want to set Autocomplete=off in entire project in all Radtextbox. like inside grid textbox and Filter item. Is this possible way to set Autocomplete=off in entire application.

    Thanks in advance,
    Dhamu
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017