Creating Poll Using ASP.NET 2.0 Client Callbacks
By AzamSharp
Views: 3858

Introduction:

 

Creating a poll on your website enables you to find out more about the interests of the user. I recently added a weekly poll system to GridViewGuy. In this article I will explain how to create an AJAX enabled polling system using ASP.NET client callbacks.

 

Database Schema:

The database schema consists of only two tables:

 

1)    PollQuestions: This table holds all the questions for the poll.

2)    PollChoices: This table holds the choices of the poll questions.

 

Take a look at the schema shown below:

 

 

 

Poll Control Architecture:

I wanted to create the polling user control in a way that it does not depend on the Page. Let’s take a look at the class diagram below:

 

 

Now, let me explain each class in details:

 

IPoll: IPoll is an interface which will be used by all the polling classes.

 

WeeklyPoll: This is the class responsible for creating weekly polls. It implements the IPoll interface.

 

PollQuestion: This i