Ejemplo n.º 1
0
        private void Bind()
        {
            DataTable table = new DataTable();

            switch (imageTabBar1.SelectItemIndex)
            {
            case 0:
                GridView1.Layout = "frmContentLayout";
                COMSSmobilerDemo.common.frmContact frmConcat = new COMSSmobilerDemo.common.frmContact();
                table = frmConcat.GetContactData();
                break;

            case 1:
                GridView1.Layout = "frmGroupLayout";
                COMSSmobilerDemo.common.frmGroup frmGroup = new COMSSmobilerDemo.common.frmGroup();
                table = frmGroup.GetGroupData();
                break;
            }
            if (table.Rows.Count > 0)
            {
                GridView1.DataSource = table;
                GridView1.DataBind();
            }
            else
            {
                GridView1.Rows.Clear();
            }
        }
Ejemplo n.º 2
0
        private void Bind()
        {
            COMSSmobilerDemo.common.frmContact user = new COMSSmobilerDemo.common.frmContact();
            DataTable table = new DataTable();

            if (isGroup == true)
            {
                table = user.GetContactData();
            }
            else
            {
                table = user.GetContactData1();
            }
            if (table.Rows.Count > 0)
            {
                this.GridView1.DataSource = table;
                this.GridView1.DataBind();
                if (isGroup == true)
                {
                    foreach (GridViewRow ROW in GridView1.Rows)
                    {
                        if (ROW.Cell.Items["lblUSER_ID"].DefaultValue.ToString().ToUpper() == Client.Session["UserID"].ToString().ToUpper())
                        {
                            ROW.Cell.Items["Check"].DefaultValue = true;
                            ROW.Cell.Items["Check"].Enabled      = false;
                        }
                    }
                }
                else
                {
                    foreach (GridViewRow ROW in GridView1.Rows)
                    {
                        if (Convert.ToBoolean(ROW.Cell.Items["btnAddUser"].Value) == true)
                        {
                            ROW.Cell.Items["btnAddUser"].Text      = "已添加";
                            ROW.Cell.Items["btnAddUser"].BackColor = System.Drawing.Color.White;
                            ROW.Cell.Items["btnAddUser"].ForeColor = System.Drawing.Color.Gray;
                            ROW.Cell.Items["btnAddUser"].Enabled   = false;
                        }
                    }
                }
            }
            else
            {
                this.GridView1.Rows.Clear();
            }
        }