First Retouch into .Net Programming

Hi, it has been a while since my very last post under my Learning Bible title. Today, I spent my time to re-touch .Net programming. It has been two years not doing any web programming and I have this re-touch will bring me more new ideas. Ultimately, web programming is not my next main interest. It is just a warm-up session with a familiar platform.

Today I tried our the JQuery on setting a focus onto the textbox. Simple as a piece of cake for many programmers. I started with adding the below script into my master page,
<script type=”text/javascript” src=”/scripts/jquery-1.4.1.min.js”></script>. If you need guide, this website shows how to do it.
http://stackoverflow.com/questions/22664066/jquery-in-asp-net-web-form-with-a-master-page

I am sure there are newer versions of JQuery available. I found an article which is nicely explained which methods to be used to include jQuery into your project. http://www.codeproject.com/Tips/471799/jQuery-introduction-and-how-to-use-jQuery-with-ASP 

And, there is a demo available for setting focus on a textbox. http://jsfiddle.net/4fXLn/
This demo is based on onclick() function. If you’re doing page on load, then you can just remove the onclick() function.

<script type=”text/javascript” language=”javascript”>
$(document).ready(function() {
$(‘#MainContent_LoginUser_UserName’).focus();
});
</script>

Since I’m using master page, the id turned to be MainContent_LoginUser_UserName else you can just use the id from <input>.

And, you’re done!