Sunday, March 20, 2005

How to set focus on control in asp.net

How to set focus on control in asp.net

private void SetFocus(Control ctrl) // Define the JavaScript function for the specified control. string focusScript = "script language="'javascript'"" + "document.getElementById('" + ctrl.ClientID + "').focus();script
"; // Add the JavaScript code to the page. Page.RegisterStartupScript("FocusScript", focusScript);

No comments: