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

RadInputManager - a better way?

3 Answers 89 Views
Input
This is a migrated thread and some comments may be shown as answers.
Hessner
Top achievements
Rank 2
Hessner asked on 11 Apr 2009, 09:24 PM
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?

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 14 Apr 2009, 08:48 AM
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.
0
Hessner
Top achievements
Rank 2
answered on 14 Apr 2009, 02:34 PM
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.
0
Nikolay Rusev
Telerik team
answered on 14 Apr 2009, 04:12 PM
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.
Tags
Input
Asked by
Hessner
Top achievements
Rank 2
Answers by
Sebastian
Telerik team
Hessner
Top achievements
Rank 2
Nikolay Rusev
Telerik team
Share this question
or