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 instru : 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=282";

        //查询语句的头部
        string sql_SelectFirst = " select a.*,b.[ClassName] as ClassId_Name,b.[Id] as ClassId_Id ";
        sql_SelectFirst += " from NT_Data a ";
        sql_SelectFirst += " left join NT_Class b on a.ClassId=b.Id";
        sql_SelectFirst += " where a.ClassId=282";
        sql_SelectFirst += " order by a.OrderNum desc, a.ID desc";


        DataTable dt_instrulist = WebControlsFunc.GetDataTableByAspNetPager(AspNetPager1, sql_CountFirst, sql_SelectFirst);
        lit_instrulist.Text = "";
        foreach (DataRow dr in dt_instrulist.Rows)
        {
            
            lit_instrulist.Text += "<div class='ny_qun'> <span><img src='" + dr["TitlePicture"] + "' width='150' height='110' /></span><ul class='ny_qun_list'><li class='ny_q_tit'>" + dr["Title"] + "</li><li class='mt8px'>"+FrontFunc.Cutstring(dr["Content"].ToString(),80)+"</li><li class='look_menu'><a href='instrudetails.aspx?iid=" + dr["ID"] + "'><img src='images/look.jpg' /></a></li></ul></div>";
        }


    }
    #endregion

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