Js to solve the popover problem to achieve the class jump DIV example

  • 2020-03-30 01:16:21
  • OfStack

1. Js code is as follows:

 
<%-- Realize class jump 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"> 
//A function that displays class information
function ShowClassInfo() { 
//Pop-up dialog box
$("#displayClassDiv").dialog({ 
modal: true, 
width: '700', 
height: '400', 
title: " Please select jump class: ", 
overlay: { opacity: 0.5, background: "black" }, 
buttons: { 
" determine ": function () { SubmitClassInfo(); }, 
" cancel ": 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> 

2. Cs file code:
 
public DataTable dtPTC = new DataTable();//Save class information for project staging
public DataTable dtProjectInfo = new DataTable();//Save project information

protected void Page_Load(object sender, EventArgs e) 
{ 
//The original frame top page begins with information
//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 years MM month dd day ", DateTimeFormatInfo.InvariantInfo); 
//classInfo = getClassInfo(classid); 
//DtPD = dba.SelectT_LEARNING_PROJECT(Convert.ToInt32(Session["PROJECT_ID"].ToString().Trim())); 
//homepage = DtPD.Rows[0]["HOMEPAGE"].ToString().Trim(); 
//The original frame top page information ends

//Gets the permissions currently recorded in the class.
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(); //Get project, project staging, and class information according to the user ID

getProjectInfo();//Get the items separately based on the user ID

} 
/// <summary> 
/// Get project, project staging, and class information according to the user 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"); 
} 

} 


Related articles: