Webpoll in c#[vs.net Bate2 grade: Medium High]

Source: Internet
Author: User
Tags implement
Web Webpoll in C # is implemented as a User control in a vs.net Beta2 project. The database behind the control is SQL Server, but it could easily being moved to Access. I needed a webpoll for my site, saw one do on Asptoday in VBScript for regular ASP.  I made a few modifications and converted the project to. Net and C #. A working copy of the Webpoll can is viewed at http://72t.net (what I really does in-life) or at http://Dn.yyyz.net (the INI Tial conversion of my personal site).

As you do, please send me any changes and suggestions for improving the code-i ' m still learning. Net and C #. If you are implement the poll on your site, you are should probably use in least two answers to each question-a one question L doesn ' t make much sense. The number of answers isn ' t limited-enter as many as you. Using different Poll IDs, you can have multiple polls running on the same site at the same.

Things to look for in the code:

Construction of a table with rows and cells in the C # code behind page.
Adding Radio Buttons and text to individual table cells.
Implementing a Submit Button and handler from the code behind page.
Stepping through a group of Radio Buttons to query for the checked button.
Use the cookie to overcome multiple answers the same computer.
Use of Classes for both the question and Answers
Main Files:

Default.aspx-a page used to implement. The control is registered. Two items, the Poll Id and the connection string are passed to the Webpoll control
Webpoll.ascx-the HTML portion the control. This page has has a placeholder control and is used as a place holder. All of the code (tables, etc.) are constructed in the code behind class.
Webpoll.ascx.cs-the code behind Class-the control is built entirely in the. CS code behind page. Look through the actual page for comments and explanation. It builds two tables, one to ask the questions and the results.
Webpoll.sql-the SQL Query file (created by SQL) that'll create the tables used by the Webpoll control-questions Go in ' pollquestions ' table and the answers to ' pollanswers '.
Webpoll.htm-this page
Possible improvements (if you have any, please let me know):

A user interface that could is used to add or delete questions-in This version and you have to enter the items into the DAT Abase tables manually.
A button that would allow viewing the results of previous polls.
Converting the existing UserControl to a full web control.
Source Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.