protected void Page_Load(object sender, EventArgs e) { string[] cid = myFunctions.Get_CID_from_Courses(); string[] cname = myFunctions.Course_ID_Name_Change(cid); string[] ctime = myFunctions.Get_CourseTime(cid); string[] croom = myFunctions.Get_Courses_room(cid); string[] proName = myFunctions.Get_Professor_Name(cid); string html = "<table BORDER='2'> <tr align=center> <td>課程編號</td> <td>課程名稱</td> <td>授課教授</td> <td>授課教室</td> <td>上課時間</td> </tr> "; for (int i = 0; i < cid.Length; i++) { html += "<tr align=center>"; html += "<td>" + cid[i] + "</td>"; html += "<td>" + cname[i] + "</td>"; html += "<td>" + proName[i] + "</td>"; html += "<td>" + croom[i] + "</td>"; html += "<td>" + ctime[i] + "</td>"; html += "</tr>"; } html += "</table>"; Response.Write(html); }
public void SetTable(string[] ctime, string[] course) { // 使用者輸入=> 星期節數 : 01020304 // Label ID => C0502 //Response.Write((ctime.Length - 2) / 2); // string[] time = new string[ ((ctime.Length - 2) / 2) *ctime.Length ]; // 算幾門課 course = myFunc.Course_ID_Name_Change(course); for (int i = 0; i < ctime.Length; i++) { for (int j = 2; j < ctime[i].Length; j += 2) { string time = "C" + ctime[i][0] + ctime[i][1] + ctime[i][j] + ctime[i][j + 1]; Label ct = FindControl(time) as Label; ct.Text = course[i]; } } }