This tutorial will show how we can use AJAX to dynamically generate a list of random names without calling postback. C# version.

This tutorial was created with Microsoft’s ASP.NET AJAX Extensions, which can be downloaded at this link

This tutorial makes use of the UpdatePanel control in Visual Studio’s AJAX toolbox. It will show you how we can generate random names from a string array at the click of a button, without postback.
The first thing we need to do is start an ASP.NET AJAX-Enabled Web Site within Visual Studio .NET

Then we can add our UpdatePanel, button and label to the ASPX page:

We add the following assembly reference, because we are goingto use a string array to store names:

Then we create the string array:

Then we create the method that will choose a list of names at random:

The code-behind will look something like this:

Download Source Files