protected void Page_Load(object sender, EventArgs e) { Student s = (Student)Session["user"]; if (s != null) { welcomeInfo.InnerHtml = "欢迎你," + s.Name; ExamResultService ers = new ExamResultService(); IList <ExamResult> examResultList = ers.getExamResultByStudent(s); string content = "<center><h2>" + s.Name + " 同学成绩单</h2></center>"; foreach (ExamResult er in examResultList) { content += "<h4>" + er.ExamPlan.Name + "</h4>"; IDictionary <string, string> couresScoureMap = er.CouresScoreMap; string[] keys = new string[couresScoureMap.Keys.Count]; content += "<table class='table table-striped table-bordered table-condensed'><thead><tr>"; for (int i = 0; i < keys.Length; i++) { String key = couresScoureMap.Keys.ElementAt(i); keys[i] = key; content += "<th>" + key + "</th>"; } content += "</tr></thead><tbody><tr>"; for (int i = 0; i < keys.Length; i++) { String key = keys[i]; content += "<td>" + couresScoureMap[key] + "</td>"; } content += "</tr></tbody></table>"; } TableContent.InnerHtml = content; } else { Response.Redirect("login.aspx"); } }