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

radFilter set cursor in code-behind

2 Answers 46 Views
Filter
This is a migrated thread and some comments may be shown as answers.
rik butcher
Top achievements
Rank 1
rik butcher asked on 11 Aug 2011, 02:14 PM
 can i use the command object or PreRender to set the cursor, so the user can just start typing if it's a text field rather than move the mouse and set the cursor?
 thanks again for all of your help
rik
for instance:

protected void RadFilter1_ItemCommand(object sender, RadFilterCommandEventArgs e)
{
    if (e.CommandName == RadFilter.AddExpressionCommandName )
    {
       SOMEWHERE IN HERE???
}

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 16 Aug 2011, 12:01 PM
Hello Rik,

Unfortunately the required functionality is not supported with RadFilter control. Possible workaround in this case is to use the code below for setting the focus to the latest textbox:
protected void RadFilter1_PreRender(object sender, EventArgs e)
{
    var ctrl = ControlsOfType<ITextControl>(RadFilter1).Where(p => p.GetType() != typeof(LiteralControl));
    if (ctrl.Count() > 0)
        (ctrl.Last() as Control).Focus();
}
public IEnumerable<T> ControlsOfType<T>(Control parent) where T : class
{
    foreach (Control control in parent.Controls)
    {
        if (control is T)
        {
            yield return control as T;
            continue;
        }
        foreach (T descendant in ControlsOfType<T>(control))
        {
          yield return descendant;
        }
    }
}



I hope this works for you.


Best wishes,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
rik butcher
Top achievements
Rank 1
answered on 16 Aug 2011, 12:03 PM
your solution actually worked great, the only downside is the cursor appears in every control, but i don't see that as a disadvantage.
thanks again so much for the help on this.
rik
Tags
Filter
Asked by
rik butcher
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
rik butcher
Top achievements
Rank 1
Share this question
or