Place this at the BOTTOM of your ASP.Net Page. Replace txtPartNo with the name of your control.
<script language="javascript" type="text/javascript">
Sys.Application.add_load
(
function()
{
window.setTimeout(focus, 1);
}
)
function focus()
{
document.getElementById('<%=txtPartNo.ClientID %>').focus();
}
</script>
Thank you man. Searching for this for a long time. This is working. But can you explain me the code as it would be helpful.
ReplyDeleteAlso my requirement is this.
ReplyDeleteI want to set the focus in different textboxes inside tabcontainer based on certain condition checks. In simple words, can we change the focus dynamically?