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

[Solved] set focus to a textbox in EditFormSettings FormTemplate

3 Answers 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sf
Top achievements
Rank 1
sf asked on 22 Oct 2009, 08:53 AM
in my edit template form I have a textbox. I want to set this textbox to focus upon clicking on Edit on a row in the grid to bring up the edit template form.
please help
thanks in advance

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Oct 2009, 09:05 AM
Hello,

Checkout the following documentation that shows how to focus textbox in edit form. I hope this would help in achieving the functionality.
Focus the text boxes in the edit control

-Shinu.
0
sf
Top achievements
Rank 1
answered on 23 Oct 2009, 01:46 AM
thanks Shinu for your help
I followed the instructions in the link you gave me but it dowsnt seem do anything. when i click Edit to bring up the edit view the control is not focused..... I also tried to focus a dropdownlist control, still no luck
0
James Reategui
Top achievements
Rank 1
answered on 20 Jan 2010, 08:51 PM
That worked for me. I used the ItemDataBound method (2nd one in documentation).
Be sure the type of your controls match.
Also when getting the control, sometimes it will be at posiition 1 not 0, depending if you are using a templatecolumn.
protected void RadGridServiceTypes_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
        { 
            if (e.Item is Telerik.Web.UI.GridEditableItem && e.Item.IsInEditMode) 
            { 
                Telerik.Web.UI.GridEditableItem form = (Telerik.Web.UI.GridEditableItem)e.Item; 
                TextBox comboBox = (TextBox)form["ServiceName"].Controls[1]; // this can be 0, 1 or 2 depending on template 
                comboBox.Focus(); 
            } 
        } 

Tags
Grid
Asked by
sf
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
sf
Top achievements
Rank 1
James Reategui
Top achievements
Rank 1
Share this question
or