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

set focus on editform

2 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 06 Apr 2012, 10:37 PM
when in edit or add new record form, how can I set the focus to a particular textbox?

thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 07 Apr 2012, 06:01 AM
Hello Henry,

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridEditableItem && e.Item.IsInEditMode)
        {  
            GridEditableItem item = e.Item as GridEditableItem;
 
            // bound column
            (item["ID"].Controls[0] as TextBox).Focus();
 
            //
            (item.FindControl("txtparent") as TextBox).Focus();
        }
}


Thanks,
Jayesh Goyani
0
Henry
Top achievements
Rank 1
answered on 08 Apr 2012, 05:24 AM
works, thanks.
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Henry
Top achievements
Rank 1
Share this question
or