VoteList2.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Party.Ui; using SubSonic; using System.Data; public partial class V2VOTE_VoteList2 : System.Web.UI.Page { public DataTable B; protected override void OnInit(EventArgs e) { base.OnInit(e); } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindView(); } } private void BindView() { Select sel = new Select("ID", "Name"); sel.From("Vote").Where("isclosed").IsEqualTo(false); B = sel.ExecuteDataSet().Tables[0]; } }
VoteList2.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="VoteList2.aspx.cs" Inherits="V2VOTE_VoteList2" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div style="margin: 0px 0px 0px 0px"> <table cellpadding="0" cellspacing="0"> <% int Count = B.Rows.Count; for (int i = 0; i < Count; i++) { %> <tr class="odd" > <td><a style="text-decoration: none;" href='Vote.aspx?id=<%=B.Rows[i]["id"] %>'> <%=B.Rows[i][1].ToString() %> </a></td> </tr> <% } %> </table> </div> </form> </body> </html>