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

How to add autocomplete textbox inside radgrid?

4 Answers 308 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Coolbudy
Top achievements
Rank 1
Coolbudy asked on 20 Nov 2012, 12:37 PM
how we can add autocontemplate Textbox at header part of radgrid?

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 21 Nov 2012, 03:29 AM
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.
0
Coolbudy
Top achievements
Rank 1
answered on 21 Nov 2012, 04:53 AM
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
0
Shinu
Top achievements
Rank 2
answered on 22 Nov 2012, 06:32 AM
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.
0
Dhamodharan
Top achievements
Rank 1
answered on 12 Mar 2015, 07:11 AM
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
Tags
General Discussions
Asked by
Coolbudy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Coolbudy
Top achievements
Rank 1
Dhamodharan
Top achievements
Rank 1
Share this question
or