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

📄 viewvote.aspx.cs

📁 简单投票系统,投票的数据保存在Sql数据库中
💻 CS
字号:
using System;
using System.Data;
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;

//源码之家:www.codejia.com
public partial class ViewVote : System.Web.UI.Page
{
    private int VoteCount;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            //初始化投票项目操作类
            ItemOperation io=new ItemOperation();
            //获取总投票数
            VoteCount = io.GetVoteCount();
        }
    }
    public int FormatVoteCount(String itemCount)
    { 
          //如果投票被投票
        if (itemCount.Length <= 0)
        { //返回0个百分比
            return(0);
            
        }
        if (VoteCount > 0)
        { //返回实际的百分比
            return ((Int32.Parse(itemCount) * 100 / VoteCount));
        }
        return(0);
    }

    public int FormatVoteImage(int itemCount)
    { 
        //返回百分比的图像的长度
        return (itemCount * 3);
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("Default.aspx");
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -