⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showvote.aspx.cs

📁 企业网站管理系统(C#.NET2003开发),供初学者学习!
💻 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 + -