RadInputManager - a better way?

4 posts, 0 answers
  1. Hessner
    Hessner avatar
    189 posts
    Member since:
    Mar 2003

    Posted 11 Apr 2009 Link to this post

    bool setIt = myLogic;  
    var behavior = RadInputManager1.GetSettingByBehaviorID("BlankTest");  
    foreach (Telerik.Web.UI.TargetInput item in behavior.TargetControls)  
    {  
      if (item.ControlID == "medlemsnummer")  
        {  
        item.Enabled = setIt;  
        }  

    Are there a "short hand", tried with LINQ - but no go?
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 14 Apr 2009 Link to this post

    Hello Hessner,

    Performing a loop through the items in the TargetControls collection of a given RadInputManager behavior is a valid approach to set their Enabled property. I am not sure how you would like to accomplish the same task with LINQ - can you please elaborate a bit more on your idea? Thus I will be able to provide more definite answer.

    Best regards,
    Sebastian
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hessner
    Hessner avatar
    189 posts
    Member since:
    Mar 2003

    Posted 14 Apr 2009 Link to this post

    I was looking for something like this, at first:

    var behavior = RadInputManager1.GetSettingByBehaviorID("BlankTest");     
    behavior.TargetControls.FindTargetInputById("myId").Enabled = false;  
     

    I didn't found such a property, then I tried - via LINQ, to find the property by name, but did not succeed.
  5. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2284 posts

    Posted 14 Apr 2009 Link to this post

    Hello Hessner,

    You can use the following extension method in order  to get TargetInput from TargetControls collection:
    namespace MySpace  
    {  
        public static class TargetControlCollectionExtension      
        {  
            public static TargetInput FindTargetInputByID(this Telerik.Web.UI.InputManager.TargetControlCollection collection, string id)  
            {             
                foreach (TargetInput input in collection)  
                {  
                    if (input.ControlID == id)  
                        return input;  
                }  
     
                return null;  
            }  
        }  

    I will also forward your suggestion of such method in TargetControls collection to our developers.

    Kind regards,
    Nikolay
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top