Background
In today's increasing technology demands, many tools have come onto the market and there have been reviews of specific products (or other specific things) from customers to improve the product quality or to get opinions of them, so we will make a voting control application using ASP.Net C#.
Use the following procedure to create the sample application "Empsys":
- "Start" - "All Programs" - "Microsoft Visual Studio 2010".
- "File" - "New Project" - "C#" - "Empty Web Application" (to avoid adding a master page).
- Provide the web site a name such as "VotingApp" or another as you wish and specify the location.
- Then right-click on Solution Explorer - "Add New Item" - "Default.aspx page".
- Drag and drop two buttons, three labels and one Radio Button list
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>article by vithal wadje</title>
- </head>
- <body bgcolor="black" style="color: #808000; margin-left: 30px; width: 475px;">
- <form id="form1" runat="server">
- <br />
- <div>
- <p style="font-family: 'Times New Roman', Times, serif; font-size: large; color: #808000;
- font-weight: bold; position: inherit">
- Is Vithal Wadje is Next MLA from Latur ?</p>
- <asp:RadioButtonList ID="RadioButtonList1" runat="server">
- <asp:ListItem>Yes</asp:ListItem>
- </asp:RadioButtonList>
- <asp:RadioButtonList ID="RadioButtonList2" runat="server" Font-Bold="True">
- <asp:ListItem>No</asp:ListItem>
- </asp:RadioButtonList>
- <br />
- <asp:Button ID="Button1" runat="server" OnClick="Vote_Click" Text="Vote" />
- <asp:Button ID="Button2" runat="server" Text="View Votes" OnClick="ViewVotes_Click" />
- <br />
- <br />
- <br />
- <asp:Label ID="Label1" runat="server" Text="Label" Font-Bold="True" Font-Size="X-Large"></asp:Label><br />
- <asp:Label ID="Label2" runat="server" Text="Label" Font-Bold="True" Font-Size="X-Large"></asp:Label><br />
- <asp:Label ID="Label3" runat="server" Text="Label" Font-Bold="True" Font-Size="X-Large"></asp:Label>
- </div>
- </form>
- </body>
- </html>
In the preceding sample UI I have added one question (it's just an example; I love coding, not MLA post) and on that there are two buttons of a Radio Button List that are "Yes" and "No" and after checking one of the Radio Buttons and clicking on the above Vote button, the vote will be registered and then on the View Votes button click it shows the results of all votes in one label, so let us start coding to fulfill our application requirements.
Vote Button click Logic


Vithal WadjePosted Jul 19, 2014, 1:50 PM
thanks Chien sir
chien nguyenPosted Jul 18, 2014, 12:17 PM
One simple and beautiful snippet, Thank for your post