温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:简单多功能投票/调查系统源码
当前文件路径:Votes/ShowVotes.aspx.cs

1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class ShowVotes : System.Web.UI.Page 14
{ 15
private int tid; 16
private string tname=""; 17
protected void Page_Load(object sender, EventArgs e) 18
{ 19
if (!Page.IsPostBack) 20
{ 21
BindSubjectData(GetCurrentTopicData()); 22
} 23
24
} 25
private int GetCurrentTopicData() 26
{ 27
ITopics topics = new Topics(); 28
SqlDataReader recu=topics.GetCurrentTopic(); 29
if (recu.Read()) 30
{ 31
tid = Int32.Parse(recu["t_id"].ToString()); 32
tname=recu["t_name"].ToString(); 33
} 34
recu.Close(); 35
return tid; 36
} 37
private void BindSubjectData(int tid) 38
{ 39
ISubjects subject = new Subjects(); 40
SqlDataReader recu = subject.GetSubjectByTopic(tid); 41
IDSubjects.DataSource = recu; 42
IDSubjects.DataBind(); 43
recu.Close(); 44
} 45
46
protected void IDSubjects_RowDataBound(object sender, GridViewRowEventArgs e) 47
{ 48
GridView items = (GridView)e.Row.FindControl("IDItems"); 49
if(items!=null) 50
BindItemDate(items, Int32.Parse(IDSubjects.DataKeys[e.Row.RowIndex].Value.ToString())); 51
} 52
53
private void BindItemDate(GridView gitem, int sid) 54
{ 55
IItems item = new Items(); 56
SqlDataReader recu=item.GetItemBySubject(sid); 57
gitem.DataSource = recu; 58
gitem.DataBind(); 59
60
} 61
} 62





}
}