Click here to Skip to main content
15,909,953 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
http://www.dotnetcurry.com/ShowArticle.aspx?ID=515[^]
C#
[WebMethod]
    public static List<employee> FetchEmailList(string mail)
    {
       
        GM4LDataContext _this = new GM4LDataContext();
        List<employee> _AppUser = new List<employee>();
        var fetchEmail = _this.AppUsers.Where(m => m.FirstName.ToLower().StartsWith(mail.ToLower()));

        foreach (var item in fetchEmail)
        {
            _AppUser.Add(new Employee { Email = item.FirstName });
        }
        return _AppUser;
    }



-----------------------------
XML
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".tb").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "Default.aspx/FetchEmailList",
                    data: "{ 'mail': '" + request.term + "' }",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataFilter: function (data) { return data; },
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                value: item.Email
                            }
                        }))
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        alert(textStatus);
                    }
                });
            },
            minLength: 2
        });
    });
</script>


--------------------------------



<label for="tbAuto">Enter Email: </label>
<asp:TextBox ID="tbAuto" class="tb" runat="server">

Posted
Updated 4-May-13 1:34am
v2
Comments
Anurag Sinha V 4-May-13 2:10am    
And what is the question?Where are you stuck?

1 solution

CSS
process I: Create Asp.net Application.

process II:Right Click on project name then choose "Add web Reference. after one window you getting give your webservice name

Proceess : After putting the web-service you got three option

Web services in this solution
Web services on the local machine
Browse UDDI Servers on the local network


Dipend on your requirement

kinldy check , all the best
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900