private void Populate_ViewCommunityMembersGrid(DirectoryUserData[] data) { System.Web.UI.WebControls.BoundColumn colBound; string sAppend = ""; MemberGrid.Columns.Clear(); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CHECKL"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.ItemStyle.Width = Unit.Percentage(5); colBound.HeaderText = "<input type=\"checkbox\" name=\"checkall\" id=\"req_deleted_users\" onclick=\"checkAll(\'\');\" />"; MemberGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "LEFT"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Top; colBound.HeaderText = GetMessage("generic select all msg"); MemberGrid.Columns.Add(colBound); PageSettings(); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CHECKL", typeof(string))); dt.Columns.Add(new DataColumn("LEFT", typeof(string))); int i = 0; if (!(data == null)) { // add select all row. //dr = dt.NewRow //dr("CHECKL") = "" //dr("LEFT") = GetMessage("generic select all msg") //dt.Rows.Add(dr) for (i = 0; i <= data.Length - 1; i++) { dr = dt.NewRow(); sAppend = ""; if ((setting_data.ADAuthentication == 1) && (data[i].Domain != "")) { sAppend = "@" + data[i].Domain; } if (IsUserGroupAdmin(m_cGroup.Admins, data[i].Id)) { dr["CHECKL"] = " "; } else { dr["CHECKL"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"" + data[i].Id + "\" onclick=\"checkAll(\'req_deleted_users\');\">"; } dr["LEFT"] = "<img align=\"left\" src=\"" + ((data[i].Avatar != "") ? (data[i].Avatar) : this.m_refContentApi.AppImgPath + "user.gif") + "\" width=\"32\" height=\"32\"/><span title=\"" + data[i].FirstName + " " + data[i].LastName + "\">" + data[i].DisplayName + "</span>"; dt.Rows.Add(dr); } } DataView dv = new DataView(dt); MemberGrid.DataSource = dv; MemberGrid.DataBind(); }
private void Populate_ViewFriendsGrid(DirectoryUserData[] data) { System.Web.UI.WebControls.BoundColumn colBound; string sAppend = ""; colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "CHECKL"; colBound.HeaderText = "<input type=\"checkbox\" onclick=\"checkAll(this);\" name=\"FriendsMasterCB\" value=\"" + "ID" + "\" runat=\"Server\"/>"; colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.HeaderStyle.Width = Unit.Percentage(1); colBound.Initialize(); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center; FriendGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "SEL"; colBound.HeaderText = this.GetMessage("lbl selected friend"); colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.HeaderStyle.Width = Unit.Percentage(1); colBound.Initialize(); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center; FriendGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "COL_AVATAR"; colBound.HeaderText = this.GetMessage("lbl avatar"); colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; FriendGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "COL_DISPLAYNAME"; colBound.HeaderText = this.GetMessage("generic display name"); colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.HeaderStyle.Width = Unit.Percentage(30); colBound.ItemStyle.Wrap = false; colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; FriendGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "COL_FIRSTNAME"; colBound.HeaderText = this.GetMessage("generic first name"); colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.HeaderStyle.Width = Unit.Percentage(30); colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; colBound.ItemStyle.Wrap = false; FriendGrid.Columns.Add(colBound); colBound = new System.Web.UI.WebControls.BoundColumn(); colBound.DataField = "COL_LASTNAME"; colBound.HeaderText = this.GetMessage("generic last name"); colBound.HeaderStyle.CssClass = "friendsHeader"; colBound.HeaderStyle.Width = Unit.Percentage(30); colBound.ItemStyle.VerticalAlign = VerticalAlign.Middle; colBound.ItemStyle.Wrap = false; FriendGrid.Columns.Add(colBound); PageSettings(); DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add(new DataColumn("CHECKL", typeof(string))); dt.Columns.Add(new DataColumn("SEL", typeof(string))); dt.Columns.Add(new DataColumn("COL_AVATAR", typeof(string))); dt.Columns.Add(new DataColumn("COL_DISPLAYNAME", typeof(string))); dt.Columns.Add(new DataColumn("COL_FIRSTNAME", typeof(string))); dt.Columns.Add(new DataColumn("COL_LASTNAME", typeof(string))); int i = 0; if (!(data == null)) { for (i = 0; i <= data.Length - 1; i++) { dr = dt.NewRow(); sAppend = ""; if ((setting_data.ADAuthentication == 1) && (data[i].Domain != "")) { sAppend = "@" + data[i].Domain; } dr["CHECKL"] = "<input type=\"checkbox\" name=\"req_deleted_users\" id=\"req_deleted_users\" value=\"" + data[i].Id + "\" >"; if (this.IsSelectedFriend(System.Convert.ToInt32(data[i].Id))) { dr["SEL"] = "<img src=\"" + this.m_refContentApi.AppImgPath + "check20.gif\"/>"; } else { dr["SEL"] = " "; } dr["COL_AVATAR"] = "<img class=\"friendsAvatar\" align=\"left\" src=\"" + ((data[i].Avatar != "") ? (AppendSitePathIfNone((string)(data[i].Avatar))) : this.m_refContentApi.AppImgPath + "user.gif") + "\" width=\"32\" height=\"32\"/>"; dr["COL_DISPLAYNAME"] = data[i].DisplayName; dr["COL_FIRSTNAME"] = data[i].FirstName; dr["COL_LASTNAME"] = data[i].LastName; dt.Rows.Add(dr); } } DataView dv = new DataView(dt); FriendGrid.DataSource = dv; FriendGrid.DataBind(); }