This tutorial will show you how to write a comment form web application in C# and VB.NET, using AJAX and a SQL database.
A comment form on your site can provide a way for your visitors to quickly and easily add their thoughts & opinions to your site. This tutorial will show you how to create a Comment Form using ASP.NET and a SQL Database. We will use the FormView, DataGrid and SqlDataSource controls.
In addition to this, we will make the web application more dynamic by adding AJAX functionality.

The first thing we will do is create the SQL database. We will have just one table with four columns – id, name, comments and date.
Once the database is created, we can start to build our ASPX page:

Next, we can build our FormView Insert template:

Now we can make this web page AJAX-enabled, which is extremely easy when using Visual Studio.NET 2008; we just need to add a ScriptManager and an UpdatePanel. Our ASPX page will now look something like this:

Now the only thing left to do is write code that will assign the current time to the hidden field. We will do this on Page Load:

Now when we run this web application, we will be able to add new comments to the database as well as view existing comments.

Download Source Files