您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->唐唐企业管理网站源码>>youhudianping.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:唐唐企业管理网站源码
当前文件:文件类型 TangCompany/youhudianping.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11using System.Data.SqlClient; 12using System.Text; 13 14public partial class youhudianping : System.Web.UI.Page 15{ 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 if (!Page.IsPostBack) { 19 20 BindVote(); 21 BindVotePerence(); 22 23 } 24 } 25 protected void BindVote() 26 { 27 28 RadioVote.DataSource = SqlHelper.ExcuteRead("SelectVote", CommandType.StoredProcedure, null); 29 RadioVote.DataTextField = "Name"; 30 RadioVote.DataValueField = "Id"; 31 RadioVote.DataBind(); 32 33 34 } 35 protected void BindVotePerence() { 36 37 StringBuilder builder = new StringBuilder(); 38 SqlDataReader dr = SqlHelper.ExcuteRead("SelectVote", CommandType.StoredProcedure, null); 39 float txtTotal = float.Parse(SqlHelper.ExcuteSclare("SELECT SUM(Total) FROM [Vote] WHERE Vis=1", CommandType.Text, null).ToString()); 40 while (dr.Read()) { 41 42 builder.Append("<div id=\"VoteImg1\"><table width=\"40\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td width=\"9\" height=\"150\" align=\"center\" valign=\"bottom\"></td>"); 43 builder.Append("<td width=\"22\" align=\"center\" valign=\"bottom\" class=\"VoteImg_border\">"); 44 builder.Append("<img src=\"flpicture/VoteImg.gif\" width=\"20\" height=\""+Precent(int.Parse(dr["Total"].ToString())/txtTotal)+"\" border=\"0\" /></td><td width=\"9\" align=\"center\" valign=\"bottom\"></td>"); 45 builder.Append("</tr><tr><td height=\"25\" colspan=\"3\" align=\"center\">"+dr["Name"].ToString()+"</td></tr></table></div>"); 46 47 } 48 VoteImg.InnerHtml = builder.ToString(); 49 50 } 51 protected int Precent(float txtNum) { 52 53 int txtHeight; 54 55 if (txtNum <0.02) 56 { 57 txtHeight = 1; 58 59 } 60 else { 61 62 txtHeight = Convert.ToInt32(txtNum * 120); 63 64 } 65 return txtHeight; 66 67 } 68 protected void ButtonVote_Click(object sender, EventArgs e) 69 { 70 SqlParameter[] paras ={ new SqlParameter("@Id", SqlDbType.Int, 4) }; 71 paras[0].Value = int.Parse(RadioVote.SelectedValue.ToString()); 72 SqlHelper.ExcuteNonQurey("UserVote", CommandType.StoredProcedure, paras); 73 Response.Write("<script>alert('投票成功')</script>"); 74 Response.Redirect("Default.aspx"); 75 } 76} 77
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:唐唐企业管理网站源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号