radFilter set cursor in code-behind

3 posts, 0 answers
  1. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 11 Aug 2011 Link to this post

     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. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 16 Aug 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rik butcher
    rik butcher avatar
    106 posts
    Member since:
    Jul 2009

    Posted 16 Aug 2011 Link to this post

    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
Back to Top