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

Clear focus on edited item when prepopulated

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard Weeks
Top achievements
Rank 2
Richard Weeks asked on 08 Aug 2011, 11:54 PM
I have a grid that, upon new or edited record displays GridNumericColumns with partially prepopulated values (e.g. 1234).

When clicking the cell, the prepopulated value is highlighted. Any typing will clear the prepopulated value. I don't want that.

Ideally, I'd like the cursor to position after the partially prepopulated value when the user clicks the cell, so they can complete the value (e.g. 12345678).

Any ideas?

Richard

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 12 Aug 2011, 07:52 AM
Hi Richard,

For this purpose you can set the SelectionOnFocus property of the numeric textbox to CaretToEnd, as shown below:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem item = e.Item as GridEditableItem;
        (item["ColumnUniqueName"].Controls[0] as RadNumericTextBox).SelectionOnFocus = SelectionOnFocus.CaretToEnd;
    }
}

I hope this helps.

Best wishes,
Tsvetina
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.

Tags
Grid
Asked by
Richard Weeks
Top achievements
Rank 2
Answers by
Tsvetina
Telerik team
Share this question
or