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

How to find control using Find.ById(), Get () by partial control name

1 Answer 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Behtash Moradi
Top achievements
Rank 1
Behtash Moradi asked on 18 Mar 2011, 12:56 AM
As .aspx page generates clientid for controls , how we can  find control  by server side id instead of  generated id
For example
using Find.ById("txtName") instead of Find.ById("ctrl00_ctrl1_txtName").

We have developed following utility function for finding control using server side id but  I would like using a Telerik API if exists

       protected T FindByClinetId<T>(string id) where  T:HtmlControl,new()
        {
           
            return Find.AllControls<T>().Where(x => (x.ID.EndsWith(id))).Single();
        }


Thanks
Behtash

1 Answer, 1 is accepted

Sort by
0
Stoich
Telerik team
answered on 18 Mar 2011, 05:08 PM
Hello Behtash,
    it sounds like you need to use a FindExpression. Check out this article:
http://www.artoftest.com/support/webaii/topicsindex.aspx

Let me know if you require further assistance!

Greetings,
Stoich
the Telerik team
Tags
General Discussions
Asked by
Behtash Moradi
Top achievements
Rank 1
Answers by
Stoich
Telerik team
Share this question
or