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

How to find a textbox control when the PreRender event is occured??

4 Answers 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brew Hutch
Top achievements
Rank 1
Brew Hutch asked on 01 Jul 2010, 11:28 PM
I have a textbox control inside the FilterTemplate as shown below:

<telerik:GridTemplateColumn UniqueName="firstname" > 
    <ItemTemplate> 
        ... 
    </ItemTemplate> 
    <FilterTemplate>                                 
        <asp:textbox runat="server" id="txtBox1" text=""/> 
    </FilterTemplate> 
</telerik:GridTemplateColumn> 

How can I get the textbox control when the RadGrid PreRender event is occurred?

Thanks
Brew

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 02 Jul 2010, 06:00 AM
Hello Brew,

You can try the following code snippet in PreRender event to access the TextBox control inside FilterTemplate.

C#:
  
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        GridFilteringItem filterItem = (GridFilteringItem)RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)[0]; 
        TextBox txtBox = (TextBox)filterItem.FindControl("txtBox1"); 
    } 

Thanks,
Princy.


0
Brew Hutch
Top achievements
Rank 1
answered on 02 Jul 2010, 02:55 PM
thx. it works!!!!
0
Dariusz
Top achievements
Rank 1
answered on 04 Nov 2011, 11:36 AM
Is there a way to access the controll in FilterTemplate before any items in RadGrid are created?
0
Shinu
Top achievements
Rank 1
answered on 04 Nov 2011, 11:51 AM
Hello Dariusz,

Try the following code snippet in ItemCreated event.
C#:
protected void Grid_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
    if (e.Item is GridFilteringItem)
    {
     GridFilteringItem item = (GridFilteringItem)e.Item;
     TextBox txt = (TextBox)item.FindControl("TextBox1");
   }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Brew Hutch
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Brew Hutch
Top achievements
Rank 1
Dariusz
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or