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

Setting value of "Textbox.text" in <filtertemplate>

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Archolet
Top achievements
Rank 1
Archolet asked on 19 Sep 2013, 01:54 PM
How can i set value of textbox.text in <filtertemplate> that inside a grid.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Sep 2013, 04:15 AM
Hi Archolet,

Please try the following code snippet to access the textbox in filtertemplate.

ASPX:
<FilterTemplate>
  <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</FilterTemplate>

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridFilteringItem)
       {
           GridFilteringItem filter=(GridFilteringItem)e.Item;
           TextBox txt = (TextBox)filter.FindControl("TextBox1");
           txt.Text = "Your text";
       }
   }

Thanks,
Princy
Tags
Grid
Asked by
Archolet
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or