I can use both in the code behind:
SetFocus() - "Sets the browser focus to the specified control."
Focus() - "Sets input focus to a control."
In practice, what's the difference?
Thanks!
I can use both in the code behind:
SetFocus() - "Sets the browser focus to the specified control."
Focus() - "Sets input focus to a control."
In practice, what's the difference?
Thanks!
From msdn:
To set focus on an ASP.NET Web server control
Call the control's Focus method.
-or-
Call the page's SetFocus method, passing it the ID of the control on which you want to set focus.
Page.SetFocus
can accept a control's client ID as a string instead of a reference to the control itself, which may be useful if you can't get a reference to the control to call its Focus method.
control.Focus()
is identical to Page.SetFocus(control)
. In fact, all is does is call SetFocus...
public virtual void Focus()
{
this.Page.SetFocus(this);
}