コード例 #1
0
 void loadTags()
 {
     CollectionPager1.DataSource = objTags.GetAllTags().DefaultView;
     CollectionPager1.DataBind();
     CollectionPager1.PageSize      = 20;
     CollectionPager1.BindToControl = rptData;
     rptData.DataSource             = CollectionPager1.DataSourcePaged;
     rptData.DataBind();
 }
コード例 #2
0
ファイル: NewsAdd.aspx.cs プロジェクト: proseco91/Ask14
    void loadTags()
    {
        string    _htmlClass = "";
        DataTable dbTags     = objTags.GetAllTags();
        //Lấy list tag_id của thành viên.
        string listTags = "";

        string[] sp_list = { };
        if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
        {
            DataTable dbListTags = cnts.GetTableWithCommandText("select * From tblNewsTags where News_ID=" + Request.QueryString["ID"]);
            if (dbListTags.Rows.Count > 0)
            {
                listTags = dbListTags.Rows[0]["TAG_ID"].ToString();
                sp_list  = listTags.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            }
        }



        foreach (DataRow item in dbTags.Rows)
        {
            string _name = item["Name"].ToString();
            string _id   = item["ID"].ToString();
            //Kiểm tra xem kH đã check tags nào chưa?
            string checkeds = "";

            if (_id != "")
            {
                foreach (var arrID in sp_list)
                {
                    if (Convert.ToInt32(_id) == Convert.ToInt32(arrID))
                    {
                        checkeds = "checked='checked'";
                        break;
                    }
                }


                _htmlClass += "<div class='inputtypeNewTags' style='padding: 10px;float:left; border-bottom: 1px solid #ddd;font-size:12px;'><input " + checkeds + " style='clear:left;margin-right:5px;' type='checkbox' value='" + _id + "'/>&nbsp;<strong>" + _name + "</strong></div>";
            }
        }
        ltTags.Text = _htmlClass;
    }