1 、 JS 代码如下 :
复制代码代码如下:
<%-实现班级跳转 Div-%>
<div id = "displayclassDiv" style = "display: none;">
<ul>
<%
untuk (int i = 0; i <dtptc.rows.count; i ++)
{
if (dtptc.rows [i] ["isPro"]. tostring () == "1")
{
%>
<li>
<h1>
<span id = '< %= dtptc.rows [i] ["ProjectId"]. ToString () %>'> < %= dtptc.rows [i] ["ProjectName"]. ToString () %> </span > </h1>
<%
untuk (int j = 0; j <dtptc.rows.count; j ++)
{
if (dtptc.rows [i] ["ProjectId"]. ToString () == dtptc.rows [j] ["ProjectId"]. ToString () && dtptc.rows [j] ["isPro"]. Tostring () == "2")
{
%>
<dl>
<dt id = '< %= dtptc.rows [j] ["termid"]. tostring () %>'> < %= dtptc.rows [j] ["termname"]. ToString (). trim () % > </dt>
<dd>
<%
int p_count = 0;
untuk (int k = 0; k <dtptc.rows.count; k ++)
{
if (dtptc.rows [k] ["isPro"]. tostring () == "3" && dtptc.rows [j] ["termid"]. ToString () == dtptc.rows [k] ["Termid" ] .ToString ())
{
p_count ++;
if (dtptc.rows [k] ["classid"]. tostring () == sesi ["classid"]. ToString ())
{
%>
<input id = '<%= dtptc.rows [k] ["classId"]. ToString ()%>' type = "Radio" name = "rd_class" value = '<%= dtptc.rows [k] [" ClassId "]. ToString () %> 'checked /> < %= dtptc.rows [k] [" classname "]. ToString () %>
<%} lain
{
%>
<input id = '<%= dtptc.rows [k] ["classId"]. ToString ()%>' type = "Radio" name = "rd_class" value = '<%= dtptc.rows [k] [" ClassId "]. ToString () %> ' /> < %= dtptc.rows [k] [" className "]. ToString () %>
<%
}
if (p_count % 2 == 0)
{
%> <br /> <%
}
}
}
%>
</dd>
</ll>
<%
}
}
%>
</li>
<%
}
}
%>
</ul>
</div>
<type skrip = "Teks/JavaScript">
// 显示班级信息的函数
function showclassinfo () {
// 弹出对话框
$ ("#DisplayClassDiv"). Dialog ({
Modal: Benar,
Lebar: '700',
Tinggi: '400',
Judul: "请选择跳转班级 :",
overlay: {opacity: 0,5, latar belakang: "hitam"},
Tombol: {
"确定": function () {submitclasssinfo (); },
"取消": function () {$ (this) .dialog ("hancurkan"); }
},
tutup: function (event, ui) {$ (this) .dialog ("hancurkan"); }
});
}
fungsi submitclassinfo () {
var objclass = $ ('[name = rd_class]: checked');
var classid = objclass.val ();
window.location.href = '../classportal/classportal.aspx?class_id='+classid;
}
</script>
2 、 CS 文件代码 :
复制代码代码如下:
datatable publik dtptc = datatable baru (); // 保存项目 项目分期 班级信息
datatable publik dtprojectInfo = datatable baru (); // 保存项目信息
Lindung void page_load (pengirim objek, EventArgs e)
{
// 原框架 Top 页面信息开始
//User.issessionInvalid ();
clscurrentUser user = mm.getSession ();
User_id = int.parse (user.userid);
if (request.querystring ["classid"]! = null)
{
Sesi ["classId"] = request.queryString ["classId"]. ToString ();
classId = sesi ["classid"]. ToString ();
getClassinfo ();
}
kalau tidak
{
classId = sesi ["classid"]. ToString ();
getClassinfo ();
}
// username = user.getRealName ();
nama pengguna = user.userrealname;
waktu = datetime.now.toString ("yyyy 年 mm 月 dd 日", datetimeformatinfo.invariantInfo);
// classInfo = getClassinfo (classId);
// dtpd = dba.selectt_learning_project (convert.toint32 (sesi ["proyek_id"]. Tostring (). Trim ()));
// beranda = dtpd.rows [0] ["beranda"]. ToString (). trim ();
// 原框架 Top 页面信息结束
// 获取当前用记在本班中的权限。
String sqlRole = "Pilih cType dari t_pub_user_class di mana classid =" + sesi ["classId"]. ToString () + "dan userid =" + mm.userid;
Datatable dtrole = bdb.runquery (sqlrole);
if (dtrole.rows.count> 0)
{
peran = dtrole.rows [0] ["ctype"]. ToString ();
}
getAllInfo (); // 根据用户 id 分别获取项目、项目分期、班级信息
getProjectInfo (); // 根据用户 id 分别获取项目
}
/// <summary>
/// 根据用户 id 分别获取项目、项目分期、班级信息
/// </summary>
void getAllinfo () yang dilindungi
{
int userid = convert.toint32 (mm.getSession (). userId);
string procname = "hzx_selectclass_byuserid";
Sqlparameter [] sp = sqlparameter baru [] {sqlparameter baru ("@user_id", userid)};
mencoba
{
dtptc = bdb.runprocQuery (procname, sp);
}
Catch (Exception EE)
{
Response.redirect ("../../../ errorPage.aspx");
}
}