Пример #1
0
 private void TmpBind()
 {
     TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate();
     this.ddltmp_col.Items.Clear();
     this.ddltmp_col.Items.Add(new ListItem("--请选择栏目模板--", ""));
     DataTable dt = JpTemplate.GetTemplates("0");
     foreach (DataRow dr in dt.Rows)
     {
         string Id = dr["url"].ToString();
         string Title = dr["description"].ToString().Trim() + " [" + Id + "]";
         this.ddltmp_col.Items.Add(new ListItem(Title, Id));
     }
     this.ddltmp_art.Items.Clear();
     this.ddltmp_art.Items.Add(new ListItem("--请选择文章模板--", ""));
     dt.Clear();
     dt = JpTemplate.GetTemplates("1");
     foreach (DataRow dr in dt.Rows)
     {
         string Id = dr["url"].ToString();
         string Title = dr["description"].ToString().Trim() + " [" + Id + "]";
         this.ddltmp_art.Items.Add(new ListItem(Title, Id));
     }
 }
Пример #2
0
    private void RptBind()
    {
        if (this.Request.QueryString["page"] != null)
            this.page = int.Parse(this.Request.QueryString["page"].ToString());
        else
            this.page = 1;

        string tclass = "";
        if (Request.QueryString["tclass"] != null)
            tclass = Request.QueryString["tclass"].ToString();

        this.txtclass.Text = tclass;
        this.txtKeywords.Text = this.keywords;
        txtPageNum.Text = this.pageSize.ToString();
        txtPage.Text = this.page.ToString();

        TPortalClass.JpTemplate JpTemplate = new TPortalClass.JpTemplate();
        DataTable dt = JpTemplate.GetTemplates(tclass, this.txtKeywords.Text);
        this.totalCount = dt.Rows.Count;
        DataTable tempTable = dt.Clone();
        for (int i = (this.page - 1) * this.pageSize; i < this.page * this.pageSize; i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }
        rptList.DataSource = tempTable;
        rptList.DataBind();

        //翻页
        //string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
        //        this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, "__id__");
        TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon();
        string pageUrl = JpCommon.CombUrlTxt("list_template.aspx", "page={0}&rnd={1}&keywords={2}&tclass={3}",
            "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + "", "" + this.txtclass.Text + "");
        PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
    }