js解决弹窗问题实现班级跳转DIV示例
<%--实现班级跳转DIV--%>
<div id="displayClassDiv" style="display:none;" class="gp_box">
<ul>
<%
for(int i=0;i<dtPTC.Rows.Count;i++)
{
if (dtPTC.Rows[i]["ISPRO"].ToString() == "1")
{
%>
<li>
<h1 class="gp_title" >
<span id='<%=dtPTC.Rows[i]["ProjectID"].ToString() %>'><%=dtPTC.Rows[i]["ProjectName"].ToString() %></span></h1>
<%
for (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 class="gp_list" >
<dt id='<%=dtPTC.Rows[j]["TermID"].ToString() %>'><%=dtPTC.Rows[j]["TermName"].ToString().Trim() %></dt>
<dd class="grap">
<%
int p_count = 0;
for (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">
//显示班级信息的函数
function ShowClassInfo() {
//弹出对话框
$("#displayClassDiv").dialog({
modal: true,
width: '700',
height: '400',
title: "请选择跳转班级:",
overlay: { opacity: 0.5, background: "black" },
buttons: {
"确定": function () { SubmitClassInfo(); },
"取消": function () { $(this).dialog("destroy"); }
},
close: function (event, ui) { $(this).dialog("destroy"); }
});
}
function SubmitClassInfo() {
var ObjClass = $('[name=rd_class]:checked');
var ClassID=ObjClass.val();
window.location.href = '../ClassPortal/ClassPortal.aspx?CLASS_ID='+ClassID;
}
</script>
public DataTable dtPTC = new DataTable();//保存项目 项目分期 班级信息
public DataTable dtProjectInfo = new DataTable();//保存项目信息
protected void Page_Load(object sender, 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();
}
else
{
classid = Session["CLASSID"].ToString();
getClassInfo();
}
//username = user.GetRealName();
username = user.UserRealName;
time = DateTime.Now.ToString("yyyy年MM月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 from T_PUB_USER_CLASS where ClASSID=" + Session["CLASSID"].ToString() + " and 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>
protected void getALLInfo()
{
int UserID = Convert.ToInt32(mm.GetSession().UserID);
string procName = "HZX_SelectCLASS_ByUserID";
SqlParameter[] sp = new SqlParameter[] { new SqlParameter("@USER_ID", UserID) };
try
{
dtPTC = bdb.RunProcQuery(procName, sp);
}
catch (Exception ee)
{
Response.Redirect("../../../ErrorPage.aspx");
}
}