Click here to Skip to main content
15,895,142 members
Articles / Web Development / HTML

Load and Display Page Contents Asynchronously with Full Postback Support

Rate me:
Please Sign up or sign in to vote.
4.87/5 (72 votes)
14 Sep 2010Ms-PL9 min read 589.3K   4.3K   242  
An AJAX UpdatePanel with less communication overhead and better performance
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Permissive License.
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx.
// All other rights reserved.


using System;
using System.Collections.Generic;
using System.Web.Services;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class AutoComplete : WebService
{
    public AutoComplete()
    {
    }

    [WebMethod]
    public string[] GetCompletionList(string prefixText, int count)
    {
        if (count == 0)
        {
            count = 10;
        }

        if (prefixText.Equals("xyz"))
        {
            return new string[0];
        }

        Random random = new Random();
        List<string> items = new List<string>(count);
        for (int i = 0; i < count; i++)
        {
            char c1 = (char) random.Next(65, 90);
            char c2 = (char) random.Next(97, 122);
            char c3 = (char) random.Next(97, 122);

            items.Add(prefixText + c1 + c2 + c3);
        }

        return items.ToArray();
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior) iucon GmbH
Germany Germany
My name is Stefan and I am working at iucon GmbH (http://www.iucon.de), a german software development company.
Our main focus is the development of online shops including the ERP backend.
We also develop custom software solutions for our customers and are able to support other companies and developers in using the following technologies, because we use them every day Wink | ;-)

- .NET Framework 2.0
- .NET Framework 3.0
- .NET Framework 3.5
- Windows Workflow Foundation
- C#
- ASP.NET
- ASP.NET AJAX
- SQL Server 2005 T-SQL
- ADO .NET
- Reporting Services
- Integration Services
- XML Webservices
- Database Design
- Payment systems

You can find information about our ERP software iuBIZ on http://www.iubiz.de which is totally written in .NET by using most of the cool new technologies like Workflow Foundation, Reporting Services, ClickOnce-Deployment. Feel free to take a look at the website and see Microsoft's new technologies in action Wink | ;-)

Comments and Discussions