第四章 前台主要功能模块实现
4.1 首页
采用三分栏结构,导航用Repeater控件进行数据绑定,如下图4.1所示:
图4.1 前台首页界面图
其主要代码如下:
protected void Page_Load(object sender, EventArgs e) {
Session["i"] = 1;
string t1 = "0";
string t2 = "1";
SqlConnection cn = new SqlConnection();
cn.ConnectionString = "Data Source=127.0.0.1;Initial Catalog=Excellent courses;uid=sa;pwd=";
string str = "select onedhid,onedhname,onepic,state from main where twodhid=" + t1 + "and state="+t2+"";
SqlDataAdapter rst = new SqlDataAdapter(str, cn);
cn.Open();
DataSet rdt = new DataSet();
rst.Fill(rdt);