Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
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
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 '.
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.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.