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

Default setting for SelectionOnFocus?

2 Answers 26 Views
Input
This is a migrated thread and some comments may be shown as answers.
Allin
Top achievements
Rank 1
Allin asked on 30 Oct 2013, 04:42 PM
Hi,

Actually, the defaut is 'None'

I try to find a setting to set SelectionOnFocus="SelectAll" by defaut for all input into my application. Is it possible without parse all webpage to make manually the change?

ty

2 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 31 Oct 2013, 08:13 AM
Hi Allin,

The Default is "None" for RadTextBox and it is set to "SelectAll" for NumericTextBox.

Yes you can change it globally, using a ControlAdapter.

Create an RadInputAdapter.cs with the content below and place inside App_Code folder in your site.
using System;
using System.Web.UI.Adapters;
using Telerik.Web.UI;
public class RadInputAdapter : ControlAdapter
{
    protected override void OnLoad(EventArgs e)
    {
        var input = this.Control as RadInputControl;
        if (input != null)
        {
            input.SelectionOnFocus = SelectionOnFocus.SelectAll;
        }
 
        base.OnLoad(e);
    }
}

Now in the App_Browsers folder create an default.browser with this content:
<browsers>
  <browser refID="Default">
    <controlAdapters>
      <adapter
        controlType="Telerik.Web.UI.RadTextBox"
        adapterType="RadInputAdapter"
      />
      <adapter
        controlType="Telerik.Web.UI.RadNumericTextBox"
        adapterType="RadInputAdapter"
      />
      <adapter
        controlType="Telerik.Web.UI.RadMaskedTextBox"
        adapterType="RadInputAdapter"
      />
      <adapter
        controlType="Telerik.Web.UI.RadDateInput"
        adapterType="RadInputAdapter"
      />
    </controlAdapters>
  </browser>
</browsers>

I hope this helps.

Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Allin
Top achievements
Rank 1
answered on 31 Oct 2013, 02:08 PM

Hello Vasil,

Exactly what i need.

Thank you very much!!
Tags
Input
Asked by
Allin
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Allin
Top achievements
Rank 1
Share this question
or