1 、 JS 代码如下 :
复制代码代码如下:
<%-实现班级跳转 div-%>
<div id = "displayclassdiv" style = "display: none;">
<ul>
<%
для (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>
<%
для (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;
для (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 () == session ["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 () %>
<%} else
{
%>
<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>
</dl>
<%
}
}
%>
</li>
<%
}
}
%>
</ul>
</div>
<script type = "text/javascript">
// 显示班级信息的函数
функция showclassinfo () {
// 弹出对话框
$ ("#displayclassdiv"). Dialog ({
Модал: Правда,
Ширина: '700',
высота: '400',
Название: «请选择跳转班级 :»,
наложение: {непрозрачность: 0,5, фон: "черный"},
кнопки: {
"确定": function () {OpperClassInfo (); },
"取消": function () {$ (this) .dialog ("Drouse"); }
},
Close: function (event, UI) {$ (this) .dialog ("dissult"); }
});
}
Функция OPPINCLASSINFO () {
var objclass = $ ('[name = rd_class]: проверено');
var classid = objclass.val ();
window.location.href = '../classportal/classportal.aspx?class_id='+classid;
}
</script>
2 、 CS 文件代码 :
复制代码代码如下:
public DataTable DTPTC = new DataTable (); // 保存项目 项目分期 班级信息 班级信息
public DataTable dtProjectInfo = new DataTable (); // 保存项目信息
Защищенная void page_load (отправитель объекта, Eventargs E)
{
// 原框架 Top 页面信息开始
//User.issessionInvalid ();
clscurrentuser user = mm.getsession ();
User_id = int.parse (user.userid);
if (request.querystring ["classid"]! = null)
{
Session ["classid"] = request.querystring ["classid"]. ToString ();
classid = session ["classid"]. toString ();
getClassInfo ();
}
еще
{
classid = session ["classid"]. toString ();
getClassInfo ();
}
// userName = user.getRealName ();
username = user.userrelname;
time = datetime.now.toString ("yyyy 年 мм 月 dd 日", datetimeformatinfo.invariantinfo);
// classInfo = getClassInfo (classid);
// dtpd = dba.selectt_learning_project (convert.toint32 (session ["project_id"]. ToString (). Trim ()));
// homepage = dtpd.rows [0] ["HomePage"]. ToString (). Trim ();
// 原框架 Top 页面信息结束
// 获取当前用记在本班中的权限。
string sqlrole = "select ctype из t_pub_user_class, где classid =" + session ["classid"]. toString () + "и userId =" + mm.UserId;
DataTable DTROLE = BDB.RUNQUERY (SQLROLE);
if (dtrole.rows.count> 0)
{
ROLE = DTROLE.ROWS [0] ["CTYPE"]. ToString ();
}
getallinfo (); // 根据用户 ID 分别获取项目、项目分期、班级信息
getProjectInfo (); // 根据用户 ID 分别获取项目
}
/// <summary>
/// 根据用户 ID 分别获取项目、项目分期、班级信息
/// </summary>
Защищенный void getallinfo ()
{
int userId = convert.toint32 (mm.getSession (). userId);
string procname = "hzx_selectclass_byuserid";
SqlParameter [] sp = new sqlParameter [] {new sqlParameter ("@user_id", userId)};
пытаться
{
dtptc = bdb.runprocquery (procname, sp);
}
Уловитель (исключение EE)
{
Response.redirect ("../../../ errorpage.aspx");
}
}