?? showvote.aspx.cs
字號:
?using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class ShowVote : System.Web.UI.Page
{
int voteTotal = 0;
protected void Page_Load(object sender, EventArgs e)
{
SetVoteTotal();
if (!Page.IsPostBack)
{
BindVoteListData();
VoteMessage.Text = "總票數為:" + voteTotal.ToString();
}
}
private void SetVoteTotal()
{
GetContent content = new GetContent();
OleDbDataReader dr = content.SetVote();
while (dr.Read())
{
voteTotal += Int32.Parse(dr["VoteCount"].ToString());
}
dr.Close();
}
private void BindVoteListData()
{
GetContent content = new GetContent();
OleDbDataReader dr1 = content.BindVote();
VoteList.DataSource = dr1;
VoteList.DataBind();
dr1.Close();
}
public int FormatVoteCount(String voteCount)
{
if (voteCount.Length <= 0)
{
return (0);
}
if (voteTotal > 0)
{
return ((Int32.Parse(voteCount) * 100 / voteTotal));
}
return (0);
}
public int FormatVoteImage(int voteCount)
{
return (voteCount * 3);
}
protected void WebOnlineVoteBtn_Click(object sender, EventArgs e)
{
Response.Redirect("~/WebOnlinVote.aspx");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -