您目前尚未登陆,请选择【登陆】或【注册
首页->投票调查->简单多功能投票/调查系统源码>>ShowVotesByPictures.aspx.cs>>代码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:简单多功能投票/调查系统源码


当前文件路径:Votes/ShowVotesByPictures.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; 12 13public partial class ShowVotesByPictures : System.Web.UI.Page 14{ 15 private static string sHeader=""; 16 private int tid; 17 private string SumVoteCount = ""; 18 public class VotesList 19 { 20 public string name; 21 public string count; 22 public string totalcount; 23 } 24 25 protected void Page_Load(object sender, EventArgs e) 26 { 27 if (!Page.IsPostBack) BindSubjecsData(GetCurrentTopic()); 28 SubjectsView.HeaderRow.Cells[0].Text = sHeader; 29 } 30 31 private int GetCurrentTopic() 32 { 33 ITopics topic = new Topics(); 34 SqlDataReader recu=topic.GetCurrentTopic(); 35 if (recu.Read()) 36 { 37 tid=Int32.Parse(recu["t_id"].ToString()); 38 sHeader = recu["t_name"].ToString(); 39 } 40 return tid; 41 recu.Close(); 42 } 43 44 private void BindSubjecsData(int tid) 45 { 46 ISubjects subject = new Subjects(); 47 SqlDataReader recu = subject.GetSubjectByTopic(tid); 48 SubjectsView.DataSource = recu; 49 SubjectsView.DataBind(); 50 recu.Close(); 51 } 52 53 54 protected void SubjectsView_RowDataBound(object sender, GridViewRowEventArgs e) 55 { 56 GridView itemsview =(GridView)e.Row.FindControl("ItemsView"); 57 if (itemsview != null) 58 BindItemData(itemsview,Int32.Parse(SubjectsView.DataKeys[e.Row.RowIndex].Value.ToString())); 59 } 60 61 private void BindItemData(GridView itemsview, int sid) 62 { 63 IItems item = new Items(); 64 SqlDataReader recu1=item.GetItemBySubject(sid); 65 SqlDataReader recu2 = item.GetSumItemsBySubject(sid); 66 67 if (recu2.Read())SumVoteCount = recu2["SumVoteCount"].ToString(); 68 69 ArrayList VoteArray = new ArrayList(); 70 while (recu1.Read()) 71 { 72 VotesList votelist = new VotesList(); 73 votelist.name=recu1["i_name"].ToString(); 74 votelist.count = recu1["i_count"].ToString(); 75 votelist.totalcount = SumVoteCount; 76 VoteArray.Add(votelist); 77 } 78 itemsview.DataSource = VoteArray; 79 itemsview.DataBind(); 80 recu1.Close(); 81 recu2.Close(); 82 } 83 84 public int FormatCount(string count,string sumcount) 85 { 86 if(count.Length<0||sumcount.Length<0)return (0); 87 int sumcount1 = Int32.Parse(sumcount); 88 int count1 = Int32.Parse(count); 89 return (count1*100/sumcount1); 90 } 91 92 public int FormatImage(int swidth) 93 { 94 return swidth * 4; 95 } 96 97 ///<asp:TemplateField FooterText="所占百分比"> 98 /// <ItemTemplate> 99 /// <asp:Image runat="server" ID="image" ImageUrl="~/vote.gif" Height="20" Width="<%#FormatImage(FormatCount(((VotesList)Container.DataItem).count, ((VotesList)Container.DataItem).totalcount))%>" /> 100 /// <%#FormatCount(((VotesList)Container.DataItem).count, ((VotesList)Container.DataItem).totalcount) %>% 101 /// </ItemTemplate> 102 /// </asp:TemplateField> 103} 104
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:简单多功能投票/调查系统源码

- 阿晶简单实用留言板V1.0

- Asp.net简单投票系统源码

- 在线考试系统源码(毕业设计)

- 三层结构示例项目源码 Codem..

- 家庭财务管理系统源码

- NETCMSv1.5(Build0509)完整源..

- 建筑监理门户网站全站源码

- 最简购物车(Access)源码

51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号