<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5945536975014952383</id><updated>2011-11-28T06:35:17.023+05:30</updated><title type='text'>.NET Tech Support | JAVA Online Help | ASP.NET  C# (C SHARP) VB.NET</title><subtitle type='html'>Welcome to my website. If you have any question or facing technical problem(Bug) related to .NET and Java Technologies then you can put your question on this blog and get solution from experts....</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://akashdotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://akashdotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Akash</name><uri>http://www.blogger.com/profile/17179644420900849399</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://img1.orkut.com/images/medium/1187323029/27849624.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5945536975014952383.post-3243972089513732300</id><published>2009-06-21T11:50:00.022+05:30</published><updated>2009-06-28T23:43:55.574+05:30</updated><title type='text'>ASP.NET Autofill (AutoComplete) textbox using Ajax controls and jquery (Examples with Database support &amp; without DB binding)</title><content type='html'>There are so many methods to display a AutoComplete Text Field with database or without database binding. I am going to explain some popular methods to create auto fill text box in ASP.NET.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5945536975014952383&amp;amp;postID=3243972089513732300#jquery"&gt;&lt;h3&gt; Using Jquery.&lt;/h3&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5945536975014952383&amp;amp;postID=3243972089513732300#asp"&gt; &lt;h3&gt;Using ASP.NET Ajax extension Controls.&lt;/h3&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5945536975014952383&amp;amp;postID=3243972089513732300#db"&gt; &lt;h3&gt;Database value Binding with auto complete field&lt;/h3&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;a name="jquery"&gt;&lt;span style="font-weight: bold;"&gt;  &lt;h2&gt;  1. Using JQuery and ASP.NET webservice&lt;/h2&gt;&lt;/span&gt;&lt;/a&gt;&lt;a name="jquery"&gt;&lt;br /&gt;&lt;/a&gt;First I am going to explain how to make a simple,google or facebook-like Autocomplete Textbox with jQuery and ASP.NET JSON Webservice &lt;o:p&gt;&lt;/o:p&gt;  &lt;p&gt;&lt;strong&gt;Let’s get started:&lt;/strong&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_IvagZ5K_2Qs/Sj4eYkhoWWI/AAAAAAAAAAo/ZdaaYLfKVA4/s1600-h/autofill.gif"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 263px;" src="http://3.bp.blogspot.com/_IvagZ5K_2Qs/Sj4eYkhoWWI/AAAAAAAAAAo/ZdaaYLfKVA4/s320/autofill.gif" alt="" id="BLOGGER_PHOTO_ID_5349746814833154402" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;A common solution you can use is like following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;$(document).ready(&lt;span class="keyword"&gt;function&lt;/span&gt;() {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    $(&lt;span class="string"&gt;"#txtsearch"&lt;/span&gt;).keyup(&lt;span class="keyword"&gt;function&lt;/span&gt;() {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        $(&lt;span class="string"&gt;"#results"&lt;/span&gt;).show();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        &lt;span class="keyword"&gt;var&lt;/span&gt; SearchString = $(&lt;span class="string"&gt;"#txtsearch"&lt;/span&gt;).val();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        $.ajax({  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            type: &lt;span class="string"&gt;"POST"&lt;/span&gt;,  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            contentType: &lt;span class="string"&gt;"application/json; charset=utf-8"&lt;/span&gt;,  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            dataType: &lt;span class="string"&gt;"json"&lt;/span&gt;, url: &lt;span class="string"&gt;"SearchService.asmx/Search"&lt;/span&gt;,  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            data: &lt;span class="string"&gt;"{'SearchString':'"&lt;/span&gt; + SearchString + &lt;span class="string"&gt;"'}"&lt;/span&gt;,  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            success: &lt;span class="keyword"&gt;function&lt;/span&gt;(res) {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;&lt;span style="font-style: italic;"&gt;                 &lt;/span&gt;&lt;span style="font-style: italic;" class="comment"&gt;//Append data to html&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;}})  }) });  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;pre name="code"&gt;&lt;span style="display: none;"&gt;$(document).ready(function() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;$("#txtsearch").keyup(function() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;$("#results").show();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;var SearchString = $("#txtsearch").val();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;$.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;type: "POST",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;contentType: "application/json; charset=utf-8",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;dataType: "json", url: "SearchService.asmx/Search",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;data: "{'SearchString':'" + SearchString + "'}",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;success: function(res) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;                 &lt;/span&gt;//Append data to html&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style=""&gt;    &lt;/span&gt;})&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;})&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;On keyup the webservice will be called and return us the data that starts for example with “N”.&lt;br /&gt;This is very nice and works well, but wait? We call the Webservice EVERY TIME we hit the keyboard?&lt;br /&gt;Do we need to do that?&lt;br /&gt;&lt;strong&gt;NO!!!&lt;/strong&gt;&lt;br /&gt;Here is a more powerfull solution, where we call the webservice just ONCE!&lt;br /&gt;I would like to mention that I’m using in this example a great new Javascript Library called jLinq, developed by Hugo Bonacci (&lt;a href="http://www.hugoware.net/" target="_blank"&gt;http://www.hugoware.net/&lt;/a&gt;)&lt;br /&gt;This Library allows you to query javascript arrays like linq-to-sql enumerables!&lt;br /&gt;Check it out: &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p&gt;First, we call the webservice on page load and fill an array with the recieved data.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;$(document).ready(function() {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    //Public array which will be filled with data on page load  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    var lstPersons;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    //Get data, fill into array  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    $.ajax({  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        type: "POST",  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        contentType: "application/json; charset=utf-8",  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        dataType: "json", url: "SearchService.asmx/Search",  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        data: "{}",  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        success: function(res) {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            //Fill the array with the recieved data  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            lstPersons = res.d;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            //To ensure that no text will be entered, we disable  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            //the textbox until we recieved the data  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            $("#txtsearch").removeAttr("disabled");&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;     }    })  )};  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;pre name="code"&gt;&lt;span style="display: none;"&gt;$(document).ready(function() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;//Public array which will be filled with data on page load&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;var lstPersons;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;//Get data, fill into array&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;$.ajax({&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;type: "POST",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;contentType: "application/json; charset=utf-8",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;dataType: "json", url: "SearchService.asmx/Search",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;data: "{}",&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;success: function(res) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;//Fill the array with the recieved data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;lstPersons = res.d;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;           &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;//To ensure that no text will be entered, we disable&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;//the textbox until we recieved the data&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;$("#txtsearch").removeAttr("disabled");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;})&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;)};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;Then, we define our keyup function, where we do not call the webservice with the actual serchstring, but query or array with jLinq:&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;    $("#txtsearch").keyup(function() {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        var SearchString = $("#txtsearch").val();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        //Clear the results, otherwise there will be duplicates  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        $("#results").empty();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        //Select all Employess which's PreName starts with the SearchString  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        //Note that using the useCase() command, the casing will be considered  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        var lstFilteredPersons = jLinq.from(lstPersons).useCase().startsWith("PreName", SearchString).select();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        for (var i = 0; i &lt;&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            var CurrentSearchItem = lstFilteredPersons[i];  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            var HightlightedText = CurrentSearchItem.PreName.replace(SearchString, "&lt;span class="match"&gt;" + SearchString + "&lt;/span&gt;") + " " + CurrentSearchItem.Name;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;        &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            var HtmlElement = $("&lt;b&gt;" + HightlightedText + "&lt;/b&gt;&lt;span class="small"&gt;" + CurrentSearchItem.Country + "&lt;/span&gt;");  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            $("#results").append(HtmlElement);  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        }  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        $(".searchresult").each(function(i) {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            $(this).click(function() {  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;                //On click of a result div, the fullname will be written into the seachfield  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;            var FullName = lstFilteredPersons[i].PreName + " " + lstFilteredPersons[i].Name;  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;                $("#txtsearch").val(FullName);  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;                //Hide autocomplete suggestions  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;                $("#results").hide();    });  });  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;        $("#results").show();  });  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;pre name="code"&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;$("#txtsearch").keyup(function() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;var SearchString = $("#txtsearch").val();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;//Clear the results, otherwise there will be duplicates&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;$("#results").empty();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;//Select all Employess which's PreName starts with the SearchString&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;//Note that using the useCase() command, the casing will be considered&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;var lstFilteredPersons = jLinq.from(lstPersons).useCase().startsWith("PreName", SearchString).select();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;for (var i = 0; i &lt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;         &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;var CurrentSearchItem = lstFilteredPersons[i];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;var HightlightedText = CurrentSearchItem.PreName.replace(SearchString, "&lt;span class="match"&gt;" + SearchString + "&lt;/span&gt;") + " " + CurrentSearchItem.Name;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;var HtmlElement = $("&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span style="display: none;"&gt;" + HightlightedText + "&lt;/span&gt;&lt;/b&gt;&lt;span class="small"&gt;&lt;span style="display: none;"&gt;" + CurrentSearchItem.Country + "&lt;/span&gt;&lt;/span&gt;&lt;span style="display: none;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;");&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;$("#results").append(HtmlElement);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;$(".searchresult").each(function(i) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;$(this).click(function() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;                &lt;/span&gt;//On click of a result div, the fullname will be written into the seachfield&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;            &lt;/span&gt;var FullName = lstFilteredPersons[i].PreName + " " + lstFilteredPersons[i].Name;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;                &lt;/span&gt;$("#txtsearch").val(FullName);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;                &lt;/span&gt;//Hide autocomplete suggestions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;                &lt;/span&gt;$("#results").hide();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;           &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;        &lt;/span&gt;$("#results").show();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="display: none;"&gt;&lt;span style=""&gt;    &lt;/span&gt;});&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;&lt;span style="font-weight: bold;"&gt;Note this line:&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-left: 0.25in;"&gt;var lstFilteredPersons = jLinq.from(lstPersons).useCase().startsWith("PreName", SearchString).select();  &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;pre name="code"&gt;&lt;span style="display: none;"&gt;var lstFilteredPersons = jLinq.from(lstPersons).useCase().startsWith("PreName", SearchString).select();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p&gt;Here we filter our list like in linq-to-sql with the startsWith command. All Persons will be selected where the PreName starts with the Searchstring&lt;br /&gt;Also note the useCase method, which makes the select command to only select the Persons where the casing also matches.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p&gt;Now if you test this, it’s even in Firefox running nice and clearly &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;    &lt;a name="asp"&gt;&lt;h2&gt;2. ASP.NET Ajax extension control&lt;/h2&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;AutoComplete is an ASP.NET AJAX extender that can be attached to any TextBox control, and will             associate that control with a popup panel to display words that begin with the prefix typed into             the textbox.             The dropdown with candidate words supplied by a web service is positioned on the bottom left of             the text box.         In the sample above, the textbox is associated with an AutoCompleteExtender that pulls words that             start with the contents of the textbox using a web service.&lt;br /&gt;When you have typed more content than the specified minimum word length, a popup will show words             or phrases starting with that value.  Caching is turned on, so typing the same prefix multiple             times results in only one call to the web service.       &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Example :&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;             The textbox is linked with an AutoCompleteExtender which is initialized with this code.             The &lt;em&gt;italic&lt;/em&gt; properties are optional:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;ajaxToolkit:AutoCompleteExtender&lt;br /&gt;runat="server"&lt;br /&gt;ID="autoComplete1"&lt;br /&gt;TargetControlID="myTextBox"&lt;br /&gt;ServiceMethod="GetCompletionList"&lt;br /&gt;ServicePath="AutoComplete.asmx"&lt;br /&gt;MinimumPrefixLength="2"&lt;br /&gt;CompletionInterval="1000"&lt;br /&gt;EnableCaching="true"&lt;br /&gt;CompletionSetCount="20"&lt;br /&gt;CompletionListCssClass="autocomplete_completionListElement"&lt;br /&gt;CompletionListItemCssClass="autocomplete_listItem"&lt;br /&gt;CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"&lt;br /&gt;DelimiterCharacters=";, :"&lt;br /&gt;ShowOnlyCurrentWordInCompletionListItem="true"&gt;&lt;br /&gt;&amp;lt;Animations&amp;gt;&lt;br /&gt;&amp;lt;OnShow&amp;gt; ... &amp;lt;/OnShow&amp;gt;&lt;br /&gt;&amp;lt;OnHide&amp;gt; ... &amp;lt;/OnHide&amp;gt;&lt;br /&gt;&amp;lt;/Animations&amp;gt;&lt;br /&gt;&amp;lt;/ajaxToolkit:AutoCompleteExtender&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Property Description :&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;TargetControlID&lt;/strong&gt; - The TextBox control where the user types content to be                 automatically completed&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ServiceMethod&lt;/strong&gt; - The web service method to be called.  The signature of this                 method must match the following: &lt;pre&gt;[System.Web.Services.WebMethod]&lt;br /&gt;[System.Web.Script.Services.ScriptMethod]&lt;br /&gt;public string[] GetCompletionList(string prefixText, int count) { ... }&lt;/pre&gt;                 Note that you can replace "GetCompletionList" with a name of your choice, but the return type                 and parameter name and type must exactly match, including case.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ServicePath&lt;/strong&gt; - The path to the web service that the extender will pull the                 word\sentence completions from.  If this is not provided, the service method should be a page                 method.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ContextKey&lt;/strong&gt; - User/page specific context provided to an optional overload of the                 web method described by ServiceMethod/ServicePath.  If the context key is used, it should have the                 same signature with an additional parameter named contextKey of type string:                 &lt;pre&gt;[System.Web.Services.WebMethod]&lt;br /&gt;[System.Web.Script.Services.ScriptMethod]&lt;br /&gt;public string[] GetCompletionList(&lt;br /&gt;string prefixText, int count, string contextKey) { ... }&lt;/pre&gt;                 Note that you can replace "GetCompletionList" with a name of your choice, but the return type                 and parameter name and type must exactly match, including case.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;UseContextKey&lt;/strong&gt; - Whether or not the ContextKey property should be used.  This                 will be automatically enabled if the ContextKey property is ever set (on either the client or                 the server).  If the context key is used, it should have the same signature with an additional                 parameter named contextKey of type string (as described above).&lt;/li&gt;&lt;li&gt;&lt;strong&gt;MinimumPrefixLength&lt;/strong&gt; - Minimum number of characters that must be entered before                 getting suggestions from the web service.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;CompletionInterval&lt;/strong&gt; - Time in milliseconds when the timer will kick in to get                 suggestions using the web service.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;EnableCaching&lt;/strong&gt; - Whether client side caching is enabled.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;CompletionSetCount&lt;/strong&gt; - Number of suggestions to be retrieved from the web service.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;CompletionListCssClass&lt;/strong&gt; - Css Class that will be used to style the completion list flyout.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;CompletionListItemCssClass&lt;/strong&gt; - Css Class that will be used to style an item in the AutoComplete list flyout.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;CompletionListHighlightedItemCssClass&lt;/strong&gt; - Css Class that will be used to style a highlighted item in the AutoComplete list flyout.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DelimiterCharacters&lt;/strong&gt; - Specifies one or more character(s) used to separate words. The text in the AutoComplete textbox is tokenized using these characters and the webservice completes the last token.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;FirstRowSelected&lt;/strong&gt; - Determines if the first option in the AutoComplete list will be selected by default.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;ShowOnlyCurrentWordInCompletionListItem&lt;/strong&gt; - If true and DelimiterCharacters are specified, then the AutoComplete list items display suggestions for the current word to be completed and do not display the rest of the tokens.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Animations&lt;/strong&gt; - Generic animations for the AutoComplete extender.                  &lt;ul&gt;&lt;li&gt;&lt;strong&gt;OnShow&lt;/strong&gt; - The OnShow animation will be played each time the AutoComplete                         completion list is displayed.  The completion list will be positioned correctly but hidden.                         The animation can use &lt;span class="codeReference"&gt;&lt;hideaction visible="true"&gt;&lt;/hideaction&gt;&lt;/span&gt;                         to display the completion list along with any other visual effects.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;OnHide&lt;/strong&gt; - The OnHide animation will be played each time the AutoComplete                         completion list is hidden.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;a name="db"&gt;&lt;h2&gt; Database Binding :&lt;br /&gt;&lt;/h2&gt;&lt;/a&gt;&lt;/span&gt;If you want to display values from database in autocomplete field, then you can use following simple example with webservice for database binding.&lt;br /&gt;&lt;br /&gt;First you need to define a webservice with a webmethod ‘GetCountryInfo’ to fetch the data from the country table                                         as follows :&lt;br /&gt;&lt;table width="100%" border="0" cellpadding="1" cellspacing="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="ArticleContent"&gt;&lt;table width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="CodingBorder" width="50%"&gt;                                                     [System.Web.Script.Services.ScriptService]&lt;/td&gt;                                             &lt;/tr&gt;                                         &lt;/tbody&gt;&lt;/table&gt;                                     &lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr&gt;                                     &lt;td class="ArticleContent" height="5"&gt;                       &lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;                                                     [WebMethod]&lt;br /&gt;                                       public string[] GetCountryInfo(string prefixText)&lt;br /&gt;                                       {&lt;br /&gt;                                        int count = 10;                                       &lt;br /&gt;                                        string sql = "Select * from Country Where Country_Name like @prefixText";&lt;br /&gt;SqlDataAdapter da = new SqlDataAdapter(sql,”Your Connection String Comes Here”));&lt;br /&gt;                                        da.SelectCommand.Parameters.Add("@prefixText", SqlDbType.VarChar, 50).Value                                                     = prefixText+ "%";                                       &lt;br /&gt;                                        DataTable dt = new DataTable();                                       &lt;br /&gt;                                        da.Fill(dt);                                       &lt;br /&gt;                                        string[] items = new string[dt.Rows.Count];&lt;br /&gt;                                        int i = 0;                                       &lt;br /&gt;                                        foreach (DataRow dr in dt.Rows)                                       &lt;br /&gt;                                        {                                       &lt;br /&gt;                                         items.SetValue(dr["Country_Name"].ToString(),i);                                       &lt;br /&gt;                                         i++;                                       &lt;br /&gt;                                        }                                       &lt;br /&gt;                                        return items;                                       &lt;br /&gt;                                       }&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;table width="100%" border="0" cellpadding="1" cellspacing="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="ArticleContent"&gt;                                         The above webmethod takes prefixText as argument, sends it to the query to fetch                                         only the related words that starts with the prefixText values. Then it returns the                                         result as an array of strings.                           &lt;br /&gt;             &lt;br /&gt;                           Next, in the Default.aspx page, set the AutoCompleteExtender’s TargetControlID property                                         to the TextBox Id. Now you can see a new Extenders Tab is added in the Textbox’s                                         Property window. Set ServicePath as WebService.asmx, ServiceMethod as GetCountryInfo                                         and MinimimPrefixLength as 1.                                     &lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr&gt;                                     &lt;td class="ArticleContent" height="5"&gt;                       &lt;br /&gt;&lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr&gt;                                     &lt;td class="ArticleContent"&gt;                                         &lt;table width="95%" align="center"&gt;                                             &lt;tbody&gt;&lt;tr&gt;                                                 &lt;td class="CodingBorder"&gt; &amp;lt;cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" ServicePath="WebService.asmx" TargetControlID="TextBox1"&amp;gt; &amp;lt;/cc1:AutoCompleteExtender&amp;gt; &lt;/td&gt;                                             &lt;/tr&gt;                                         &lt;/tbody&gt;&lt;/table&gt;                                     &lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr&gt;                                     &lt;td class="ArticleContent"&gt;                       &lt;br /&gt;&lt;/td&gt;                                 &lt;/tr&gt;                                 &lt;tr&gt;                                     &lt;td class="ArticleContent"&gt;                                         Now, its time to run the project. Select the Default.aspx and click on View in Browser.                                         You can see the excellent application starts to run. Type your country’s first letter.                                         See all the countries starts with that letter will appear in the popup.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;Other useful related links :&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://flux88.com/blog/jquery-auto-complete-text-box-with-asp-net-mvc/"&gt;Autofill fields with ASP.NET MVC&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://flux88.com/blog/jquery-autocomplete-with-a-hidden-value/"&gt; Auto complete with hidden value&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5945536975014952383-3243972089513732300?l=akashdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://akashdotnet.blogspot.com/feeds/3243972089513732300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://akashdotnet.blogspot.com/2009/06/aspnet-autofill-autocomplete-textbox.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/3243972089513732300'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/3243972089513732300'/><link rel='alternate' type='text/html' href='http://akashdotnet.blogspot.com/2009/06/aspnet-autofill-autocomplete-textbox.html' title='ASP.NET Autofill (AutoComplete) textbox using Ajax controls and jquery (Examples with Database support &amp; without DB binding)'/><author><name>Akash</name><uri>http://www.blogger.com/profile/17179644420900849399</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://img1.orkut.com/images/medium/1187323029/27849624.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IvagZ5K_2Qs/Sj4eYkhoWWI/AAAAAAAAAAo/ZdaaYLfKVA4/s72-c/autofill.gif' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5945536975014952383.post-3684426985008379933</id><published>2007-11-23T15:16:00.000+05:30</published><updated>2009-06-20T19:09:02.330+05:30</updated><title type='text'>HOW TO CAPTURE ENTER (Return) KEY PRESS EVENT ON TEXTBOX AND INVOKE OTHER EVENTS.....</title><content type='html'>&lt;strong&gt;&lt;span style="font-size:130%;color:#3333ff;"&gt;C# Code....&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;//first handle KeyDown Event for control on which you want to capture Enter key as follow..&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;private void textBox1_KeyDown(object sender, KeyEventArgs e)&lt;br /&gt;{&lt;br /&gt;if (e.KeyData == Keys.Enter)&lt;br /&gt;{&lt;br /&gt;//MessageBox.Show("Enter key pressed...");&lt;br /&gt;Invoke(new System.EventHandler(button1_Click)); // Invoking other event handler...&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;// Other event which will be indirectly invoked when enter key pressed on TextBox...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;private void button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("Button Clicked");&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");&lt;br /&gt;document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;try {&lt;br /&gt;var pageTracker = _gat._getTracker("UA-6172569-3");&lt;br /&gt;pageTracker._trackPageview();&lt;br /&gt;} catch(err) {}&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var infolink_pid = 23946;&lt;/script&gt;&lt;br /&gt;&lt;script type="text/javascript" src="http://resources.infolinks.com/js/infolinks_main.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5945536975014952383-3684426985008379933?l=akashdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://akashdotnet.blogspot.com/feeds/3684426985008379933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://akashdotnet.blogspot.com/2007/11/how-to-capture-enter-return-key-press.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/3684426985008379933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/3684426985008379933'/><link rel='alternate' type='text/html' href='http://akashdotnet.blogspot.com/2007/11/how-to-capture-enter-return-key-press.html' title='HOW TO CAPTURE ENTER (Return) KEY PRESS EVENT ON TEXTBOX AND INVOKE OTHER EVENTS.....'/><author><name>Akash</name><uri>http://www.blogger.com/profile/17179644420900849399</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://img1.orkut.com/images/medium/1187323029/27849624.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5945536975014952383.post-6976488639765414916</id><published>2007-11-21T17:17:00.001+05:30</published><updated>2009-06-27T19:09:40.597+05:30</updated><title type='text'>.NET Online Help....</title><content type='html'>You are most welcome to my online tech support Blog, You will get the latest posts on .NET technology here.&lt;br /&gt;&lt;br /&gt;You can Post your problems here as comment.&lt;br /&gt;You will get Free solution &amp;amp; suggestions from field experts...&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5945536975014952383-6976488639765414916?l=akashdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://akashdotnet.blogspot.com/feeds/6976488639765414916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://akashdotnet.blogspot.com/2007/11/net-online-help.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/6976488639765414916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5945536975014952383/posts/default/6976488639765414916'/><link rel='alternate' type='text/html' href='http://akashdotnet.blogspot.com/2007/11/net-online-help.html' title='.NET Online Help....'/><author><name>Akash</name><uri>http://www.blogger.com/profile/17179644420900849399</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://img1.orkut.com/images/medium/1187323029/27849624.jpg'/></author><thr:total>1</thr:total></entry></feed>
