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

Set focus on ajax call

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Regula
Top achievements
Rank 1
Regula asked on 13 Aug 2010, 04:53 PM
Hi,

I have a RadGrid with RadNumericTextBox. One of the RadNumericTextBox  has a event that fires up when the content is changed.
The problem is that after the event is called I wish to set focus in another text box in the grid but it doesn't happens anything, no expections, no focus just like I hadn't the last line of the code bellow. Notice that I have the RadGrid wraped in a Ajax UpdatedControls

Here is the changed event:

  protected void txt2_Changed(object sender, EventArgs e)
  {
  RadNumericTextBox txt1 = (RadNumericTextBox)((RadNumericTextBox)sender).Parent.FindControl("txt1");
  RadNumericTextBox txt2 = (RadNumericTextBox)sender;
  RadNumericTextBox txt3 = (RadNumericTextBox)((RadNumericTextBox)sender).Parent.FindControl("txt3");
 
  txt3.Value = txt2.Value * (txt1.Value / 100);
 
  RadAjaxManager1.ResponseScripts.Add(String.Format("$find('{0}').focus();", txt3.ClientID));
 
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Cori
Top achievements
Rank 2
answered on 13 Aug 2010, 09:34 PM
Hello Regula,

Try using RadAjaxManager1.FocusControl(txt3) and see if that works.

I hope that helps.
0
Regula
Top achievements
Rank 1
answered on 28 Jun 2011, 02:36 PM
Using:
 RadAjaxManager1.FocusControl(txt.ClientID + "_text");

worked.

Thanks!
Tags
Grid
Asked by
Regula
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Regula
Top achievements
Rank 1
Share this question
or