How to set focus on user control textbox in aspx page?
asp.net, javascript, jquery, textbox, user-controls
Solution
You can use id selector and use focus() method. For using jQuery you need to include jQuery and ensure your element is available in `DOM` before you access it. You can use document.ready for that.
$('#txt1').focus();
Or using plain JavaScript, focus()
document.getElementById('txt1').focus();
If you do not have ClientIDMode = static then you will need to use ClientID
$('#<%= txt1.Client %>').focus();
Problem
How can I set focus on asp:TextBox which is placed inside a user control by using jquery/JavaScript function in aspx page?