您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> asp.net >> 正文

WebPoll in C#Vs.net Bate2 等级:中 高

作者:作者:未…    信息学院来源:网络收集    点击数:    更新时间:2006-8-28 我要参与讨论

  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 be moved to Access. I needed a WebPoll for my site, saw one done 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 be viewed at http://72t.net (what I really do in life) or at http://Dn.yyyz.net (the initial conversion of my personal site).  

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

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 of Cookies to overcome multiple answers from the same computer.
Use of Classes for both the Question and Answers
Main Files:

Default.aspx - a page used to implement the control. The control is registered. Two items, the Poll Id and the connection string are passed to the WebPoll control
WebPoll.ascx - the html portion of the control. This page only has a PlaceHolder control that is used as a place holder. All 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 one to show the results.
WebPoll.sql - the SQL Query file (created by SQL 2000) that will create the tables used by the WebPoll control - Questions go in  'PollQuestions' table and the answers go in the 'PollAnswers '.
WebPoll.htm - this page
Possible Improvements (if you make any, please let me know) :

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

在google里搜索更多WebPoll in C#Vs.net Bate2 等级:中 高

Google
Web www.51ec.org
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
我来说两句 对此文章发表了评论
  昵 称: *必填    ·注册用户·
  评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
评 论
内 容

 
评论列表 (最新 评论仅限网友观点!)

供求信息




| 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明