using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class teacher20130320 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;

        BindData();
    }


    #region 产品绑定
    /// <summary>
    /// 数据绑定
    /// </summary>
    private void BindData()
    {

        //计算总数的语句的头部
        string sql_CountFirst = string.Empty;
        sql_CountFirst += " select";
        sql_CountFirst += " count(*)";
        sql_CountFirst += " from NT_Data ";
        sql_CountFirst += " where ClassId=280";

        //查询语句的头部
        string sql_SelectFirst = "select ID ,ClassId,Title,sTitle,TitlePicture,Intro,Content,AddTime,FilePath,OrderNum ";
        sql_SelectFirst += " from NT_Data ";
        sql_SelectFirst += " where ClassId=280";
        sql_SelectFirst += " order by OrderNum desc, ID desc";


        DataTable dt_teacher = WebControlsFunc.GetDataTableByAspNetPager(AspNetPager1, sql_CountFirst, sql_SelectFirst);
        lit_teacher.Text = "";
        foreach (DataRow dr in dt_teacher.Rows)
        {
            lit_teacher.Text += "<li><div class='fac_pic'><a href='teacherdetails.aspx?tid=" + dr["ID"] + "'><img src='" + dr["TitlePicture"] + "' /></a></div><dl class='fac_text'><dt class='fac_name'><a href='teacherdetails.aspx?tid=" + dr["ID"] + "'>" + dr["Title"] + "</a></dt><dd class='fac_zw'>" + dr["sTitle"] + "</dd><dd class='fac_about'>" +FrontFunc.Cutstring(dr["Content"].ToString(),140) + "</dd><dd><a class='more' href='teacherdetails.aspx?tid=" + dr["ID"] + "'>查看详细>></a></dd></dl></li>";
        }


    }
    #endregion

    #region 分页事件
    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {
        this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        BindData();
    }
    #endregion
}
