Пример #1
0
        private void DataBind(string key = "")
        {
            string    div  = " <div class='{0} padding5 {1}'><div style='background:{2};'>{3}</div></div>";
            string    href = "<a href='{0}' target='{1}'><span class='{2}'></span>{3}</a>";
            string    hid  = "hidden-xs hidden-sm";
            DataTable dt   = searchBll.SelByType(1, customPath2, 1);

            foreach (DataRow dr in dt.Rows)
            {
                dr["fileUrl"] = dr["fileUrl"].ToString().Replace("/Manage/", customPath2);
            }
            int pageCount = PageCommon.GetPageCount(pageSize, dt.Rows.Count);

            for (int i = 0; i < pageSize; i++)
            {
                try
                {
                    int     index   = (CPage - 1) * pageSize + i;
                    string  labelID = "Label" + (i + 1);
                    DataRow dr      = dt.Rows[index];

                    string name = dr["name"].ToString();
                    name = name.Length > 4 ? name.Substring(0, 3) : name;
                    string openType = dr["OpenType"].ToString().Equals("0") ? "_self" : "_blank";
                    string value    = string.Format(href, dr["FileUrl"], openType, dr["ico"], dr["name"]); //链接字符串
                    string size     = sizeArr[DataConvert.CLng(dr["size"])];                               //默认为中
                    string mobile   = dr["Mobile"].ToString().Equals("1") ? "" : hid;                      //是否在小屏中显示
                    model_Lit.Text += string.Format(div, size, mobile, colorArr[i], value);
                }
                catch { break; }
            }
            page_Lit.Text = CreatePaging(pageCount, CPage);
        }
Пример #2
0
        private void MyBind()
        {
            //List<M_Search> dt = b_search.GetSearchByCon(CustomerPageAction.customPath2);
            ////if (dt != null && dt.Count > 0)
            ////{
            ////    this.nocontent.Style["display"] = "none";
            ////    this.EGV.Visible = true;
            ////}
            ////else
            ////{
            ////    this.nocontent.Style["display"] = "";
            ////    this.EGV.Visible = false;
            ////}
            //if (LinkType == 3)
            //    dt = dt.FindAll(d => d.LinkType == 3);
            //else if (LinkType > 0)
            //    dt = dt.FindAll(d => d.LinkType != 3);
            DataTable dt = b_search.SelByType(1, customPath2, LinkState);

            this.EGV.DataSource = dt;
            this.EGV.DataBind();
        }