?? navi.ascx.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class tongxue_navi : System.Web.UI.UserControl
{
int userid;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["userid"] != null)
this.userid = Convert.ToInt32(Session["userid"].ToString());
loaduserinfo();
loadUserClass();
Page.Title = "歡迎光臨博客同學錄!";
}
private void loaduserinfo()
{
if(Session ["username"]!=null )
welcome.InnerHtml = "歡迎您!" + Session["username"].ToString();
}
private void loadUserClass()
{
int tid = userid;
string sql = "select tbanji.* from tbanji,tidcid where tidcid.cid=tbanji.cid and tid="+tid ;
string strconn = ConfigurationManager.ConnectionStrings["dsn"].ToString();
SqlConnection cn = new SqlConnection(strconn);
cn.Open();
SqlCommand cm = new SqlCommand(sql, cn);
SqlDataReader dr = cm.ExecuteReader();
bool validate = false;
string strJoin ="<table class=tclass cellspacing=2 cellpadding=5>";
strJoin += "<tr><td>您已經加入了如下班級:</td></tr>";
while (dr.Read())
{
validate = true;
string str1=dr["college"].ToString ()+"__"+dr["comeyear"].ToString ()+"__"+dr["classname"].ToString ();
string cid=dr["cid"].ToString ();
strJoin += "<tr height=30><td>" + str1+" ";
if (dr["adminuserid"].ToString() == Session["userid"].ToString())
strJoin += "<i><u>班級管理員</u></i>";
strJoin += "</td>";
strJoin += "<td><a href=liuyan.aspx?cid=" + cid + ">查看班級留言</a></td>";
strJoin += "<td><a href=commbook.aspx?cid=" + cid + ">查看班級通訊錄</a></td>";
strJoin += "</tr>";
}
strJoin += "</table>";
if (validate)
joinclass.InnerHtml = strJoin;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -