protected void RDTREE_LST_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item.TabIndex == 1) { HtmlTableRow tr = (HtmlTableRow)e.Item.FindControl("tr_header"); tr.Visible = false; } if (e.Item.ItemType == TreeListItemType.Item || e.Item.ItemType == TreeListItemType.AlternatingItem) { //UC_Posts UC_Posts0 = (UC_Posts)e.Item.FindControl("UC_Posts1"); List <Category_Model> list = (List <Category_Model>)ViewState["_All_Categories"]; Label lblCATEG_ID = (Label)e.Item.FindControl("lbl_CategID1"); PlaceHolder PlcH = (PlaceHolder)e.Item.FindControl("PlaceHolder1"); Label lbl_PostCount1 = (Label)e.Item.FindControl("lbl_PostCount"); var listPost = Post.GetAllPostOfCategory(int.Parse(lblCATEG_ID.Text.Trim())); var VisiblePosts = listPost.Where(x => x.Status == true).ToList(); lbl_PostCount1.Text = VisiblePosts.Count().ToString(); //if (listSub.Count > 0) //{ // UC_Posts UC_Posts0 = this.LoadControl("~/UserControl/UC_Posts.ascx") as UC_Posts; // UC_Posts0.Category_Id = lblCATEG_ID.Text; // PlcH.Controls.Add(UC_Posts0); // //UC_Posts0.BindUC(); //} } }
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem item = e.Item as TreeListDataItem; string appName = (string)DataBinder.Eval(item.DataItem, "AppName"); string appId = (string)DataBinder.Eval(item.DataItem, "AppID"); if (appId.StartsWith("{")) { appId = "" + appId.Substring(1, appId.Length - 1); } if (appId.EndsWith("}")) { appId = appId.Substring(0, appId.Length - 1) + ""; } string status = (string)DataBinder.Eval(item.DataItem, "Status"); item.CssClass = appId; item["Status"].CssClass = appId + "Status"; Color statusBackColor = GetColor(status); item["Status"].BackColor = statusBackColor; if (statusBackColor == Color.Crimson | statusBackColor == Color.Gray) { item["Status"].ForeColor = System.Drawing.Color.White; } item["DateChecked"].CssClass = appId + "Date"; } }
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { ImageButton imgb = (ImageButton)e.Item.FindControl("Edit"); TreeListDataItem gdi = (TreeListDataItem)e.Item; int pId = Int32.Parse(gdi["PermissionId"].Text); string command = String.Format("EditPermissionRecord({0});", pId); imgb.OnClientClick = command; } }
protected void SeleccionarRegistro(TreeListItemDataBoundEventArgs e) { if (!Page.IsPostBack) { if (e.Item is TreeListDataItem) { TreeListDataItem item = e.Item as TreeListDataItem; CheckBox chk = item["FG_SELECCIONADO"].Controls[0] as CheckBox; item.Selected = chk.Checked; } } }
protected void RadTreeList1_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem item = (TreeListDataItem)e.Item; // assign the appropiate javascript function to edit button ImageButton imgb = (ImageButton)item.FindControl("Edit"); string jCommand = String.Format("editPermiso('{0}');", Int32.Parse(item["PermissionId"].Text)); imgb.OnClientClick = jCommand; imgb.Visible = permiso.Modificar; } }
protected void ItemCreated(object o, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem dataItem = e.Item as TreeListDataItem; var lb = dataItem["AddSub"].Controls[1] as IdeaSeed.Web.UI.LinkButton; if (lb.Attributes["isfolder"].Equals("False")) { lb.Visible = false; } else { lb.Visible = true; } } }
protected void trlSiteHaritasi_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { bool urunMu = false; if (e.Item is TreeListDataItem) { TreeListDataItem item = e.Item as TreeListDataItem; urunMu = (item["unVitrin"].FindControl("hdnUrunMu") as HiddenField).Value.xToBooleanDefault(); if (urunMu == false) { LinkButton lnkVitrin = (item["unVitrin"].FindControl("lnkVitrin") as LinkButton); lnkVitrin.Visible = false; } } }
protected void atRiskTree_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { var level = ((DataRowView)((TreeListDataItem)e.Item).DataItem)["level"].ToString(); var key = ((DataRowView)((TreeListDataItem)e.Item).DataItem)["Key"].ToString(); var parentKey = ((DataRowView)((TreeListDataItem)e.Item).DataItem)["ParentConcatKey"].ToString(); var lblScore = ((Label)((TreeListDataItem)e.Item).FindControl("lblScore")); var lblKeyDisp = ((Label)((TreeListDataItem)e.Item).FindControl("lblKeyDisp")); if (level == "Standard") { string standardID = key.Replace(parentKey, ""); lblKeyDisp.Attributes.Add("onclick", "window.open('StandardsPage.aspx?xID=" + Standpoint.Core.Classes.Encryption.EncryptString(standardID) + "');"); lblKeyDisp.Attributes.Add("style", "cursor:pointer; text-decoration: underline; color: #034AF3"); //Get count of students int numStudents = (from DataRow sRow in TreeData.Rows select new { parentconcatkey = sRow["parentconcatkey"].ToString() }).Count(t => t.parentconcatkey == key); lblScore.Text += " : " + numStudents + " Students " + ((numStudents == 1) ? "is" : "are") + " of concern"; lblScore.ForeColor = System.Drawing.Color.FromName("Black"); lblScore.Font.Italic = true; } else if (level == "StudentName") { string studentID = key.Replace(parentKey, "").Replace("Stud",""); lblKeyDisp.Attributes.Add("onclick", "window.open('Student.aspx?childPage=yes&xID=" + Standpoint.Core.Classes.Encryption.EncryptString(studentID) + "');"); lblKeyDisp.Attributes.Add("style", "cursor:pointer; text-decoration: underline; color: #034AF3"); } else if (level == "TestGrade" || level == "TestCourse") { var lbl = ((Label)((TreeListDataItem)e.Item).FindControl("lblScore")); lbl.Visible = false; } } }
protected void atRiskTree_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { var level = ((DataRowView)((TreeListDataItem)e.Item).DataItem)["level"].ToString(); var key = ((DataRowView)((TreeListDataItem)e.Item).DataItem)["Key"].ToString(); if (level == "StudentName") { //Get count of standards int numStandards = (from DataRow sRow in TreeData.Rows select new { parentconcatkey = sRow["parentconcatkey"].ToString() }).Count(t => string.Compare(t.parentconcatkey, key) == 0); var lbl = ((Label)((TreeListDataItem)e.Item).FindControl("lblScore")); lbl.Text = numStandards + " Standard" + ((numStandards == 1) ? " is" : "s are") + " of concern"; lbl.ForeColor = System.Drawing.Color.FromName("Black"); lbl.Font.Italic = true; } } }
protected void radTreeResults_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (!(e.Item is TreeListDataItem)) return; var dataItem = (DataRowView)((TreeListDataItem)e.Item).DataItem; switch (dataItem["Level"].ToString()) { case "District": e.Item.Cells[1].Text = "<img src='../../Images/TreeIcons/district.png' alt='district'/> " + e.Item.Cells[1].Text; break; case "School": e.Item.Cells[2].Text = "<img src='../../Images/TreeIcons/school.png' alt='school'/> " + e.Item.Cells[2].Text; break; case "Teacher": e.Item.Cells[3].Text = "<img src='../../Images/TreeIcons/teacher.png' alt='teacher'/> " + e.Item.Cells[3].Text; break; case "Class": e.Item.Cells[4].Text = "<img src='../../Images/TreeIcons/class.png' alt='class'/> " + e.Item.Cells[4].Text; break; case "Student": //((TreeListDataItem)e.Item).Expanded = true; //Always a leaf e.Item.Cells[4].Controls[0].Visible = false; e.Item.Cells[5].Text = "<img src='../../Images/TreeIcons/student.png' alt='student'/> " + e.Item.Cells[5].Text; break; } }
/***************** Version 2 functions **************************/ protected void DebateList_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem itm = e.Item as TreeListDataItem; itm["PostType"].Text = "<img src='" + ModulePath + getImageIconUrl(itm["PostType"].Text) + "'>"; HyperLink userProfile = new HyperLink(); userProfile.NavigateUrl = DotNetNuke.Common.Globals.UserProfileURL(Convert.ToInt32(itm["UserId"].Text)); if (!itm["Post_Author"].Text.Equals(" ")) { userProfile.Text = itm["Post_Author"].Text + " " + itm.GetDataKeyValue("ID"); itm["Post_Author"].Controls.Add(userProfile); } else { itm["Post_Author"].Text = "guest"; } if (itm.IsChildInserted) { itm.CssClass = "whiteBack"; } } else if (e.Item is TreeListDetailTemplateItem) { TreeListDetailTemplateItem itm = e.Item as TreeListDetailTemplateItem; HiddenField hiddenpostId = (HiddenField)itm.FindControl("hiddenPostID"); /*LinkButton printPostBtn = (LinkButton)itm.FindControl("printPostLink"); printPostBtn.Attributes.Add("onclick", "openSelectedPostPrinter(" + hiddenpostId.Value + ");return false;");*/ if (DotNetNuke.Security.PortalSecurity.IsInRoles("Pilot Leaders")) { HyperLink publishPost = (HyperLink)itm.FindControl("publishPost"); HyperLink deletePost = (HyperLink)itm.FindControl("deletePost"); publishPost.Visible = true; deletePost.Visible = true; string href = Request.RawUrl.Substring(0, Request.RawUrl.IndexOf("Thread") + 7) + ATC.Tools.URLParam("Thread"); /* if post is published admins can unpublish or delete */ deletePost.NavigateUrl = href + "&PostAction=Delete&Post=" + hiddenpostId.Value; if (itm.ParentItem["IsPublished"].Text == "1") { publishPost.NavigateUrl = href + "&PostAction=Reject&Post=" + hiddenpostId.Value; publishPost.Text = "Unpublish"; } else // Post unpublished { publishPost.NavigateUrl = href + "&PostAction=Accept&Post=" + hiddenpostId.Value; publishPost.Text = "Re-publish"; } } if (statusLbl.Visible) // Thread is closed { LinkButton newPostBtn = (LinkButton)itm.FindControl("newPostBtn"); newPostBtn.Enabled = false; notifyCheck.Visible = false; notifyLabel.Visible = false; } else { if (itm.ParentItem.IsChildInserted) { //itm.CssClass = "whiteBack"; LinkButton newPostBtn = (LinkButton)itm.FindControl("newPostBtn"); newPostBtn.CssClass = "newPostActive"; } } } else if (e.Item is TreeListEditFormInsertItem) { /* If a new discussion is to be created, the post type can only be issue*/ if (DebateList.IsItemInserted) { TreeListEditFormInsertItem itm = e.Item as TreeListEditFormInsertItem; RadioButton Issue = (itm.FindControl("IssueRadio") as RadioButton); RadioButton Alter = (itm.FindControl("AlterRadio") as RadioButton); RadioButton Pro = (itm.FindControl("ProRadio") as RadioButton); RadioButton Con = (itm.FindControl("ConRadio") as RadioButton); RadioButton Comment = (itm.FindControl("CommentRadio") as RadioButton); Comment.Checked = false; Issue.Checked = true; Alter.Enabled = false; Pro.Enabled = false; Con.Enabled = false; Comment.Enabled = false; } } }
protected void grdMenuAdicionales_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { SeleccionarRegistro(e); }
//protected void TreeListChild_DataSourceNeeded(object sender, TreeListChildItemsDataBindEventArgs e) //{ // int id = Convert.ToInt32(e.ParentDataKeyValues["StandardID"].ToString()); // if (DtGrid == null) DoSearch(); // DataView dv = new DataView(DtGrid, "ParentID = " + id, "", DataViewRowState.CurrentRows); // e.ChildItemsDataSource = dv; //} protected void radTreeResults_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem item = e.Item as TreeListDataItem; item.FindControl("lnkExpandAll").Visible = item.CanExpand; if (item.Expanded) { item.FindControl("lnkCollapseAll").Visible = item.Expanded; item.FindControl("lnkExpandAll").Visible = false; } } }
/***************** Version 2 functions **************************/ protected void DebateList_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (e.Item is TreeListDataItem) { TreeListDataItem itm = e.Item as TreeListDataItem; itm["PostType"].Text = "<img src='" + ModulePath + getImageIconUrl(itm["PostType"].Text) + "'>"; HyperLink userProfile = new HyperLink(); userProfile.NavigateUrl = DotNetNuke.Common.Globals.UserProfileURL(Convert.ToInt32(itm["UserId"].Text)); if (!itm["Post_Author"].Text.Equals(" ")) { userProfile.Text = itm["Post_Author"].Text + " " + itm.GetDataKeyValue("ID"); itm["Post_Author"].Controls.Add(userProfile); } else { itm["Post_Author"].Text = "guest"; } if (itm.IsChildInserted) { itm.CssClass = "whiteBack"; } } else if (e.Item is TreeListDetailTemplateItem) { TreeListDetailTemplateItem itm = e.Item as TreeListDetailTemplateItem; HiddenField hiddenpostId = (HiddenField)itm.FindControl("hiddenPostID"); /*LinkButton printPostBtn = (LinkButton)itm.FindControl("printPostLink"); * printPostBtn.Attributes.Add("onclick", "openSelectedPostPrinter(" + hiddenpostId.Value + ");return false;");*/ if (DotNetNuke.Security.PortalSecurity.IsInRoles("Pilot Leaders")) { HyperLink publishPost = (HyperLink)itm.FindControl("publishPost"); HyperLink deletePost = (HyperLink)itm.FindControl("deletePost"); publishPost.Visible = true; deletePost.Visible = true; string href = Request.RawUrl.Substring(0, Request.RawUrl.IndexOf("Thread") + 7) + ATC.Tools.URLParam("Thread"); /* if post is published admins can unpublish or delete */ deletePost.NavigateUrl = href + "&PostAction=Delete&Post=" + hiddenpostId.Value; if (itm.ParentItem["IsPublished"].Text == "1") { publishPost.NavigateUrl = href + "&PostAction=Reject&Post=" + hiddenpostId.Value; publishPost.Text = "Unpublish"; } else // Post unpublished { publishPost.NavigateUrl = href + "&PostAction=Accept&Post=" + hiddenpostId.Value; publishPost.Text = "Re-publish"; } } if (statusLbl.Visible) // Thread is closed { LinkButton newPostBtn = (LinkButton)itm.FindControl("newPostBtn"); newPostBtn.Enabled = false; notifyCheck.Visible = false; notifyLabel.Visible = false; } else { if (itm.ParentItem.IsChildInserted) { //itm.CssClass = "whiteBack"; LinkButton newPostBtn = (LinkButton)itm.FindControl("newPostBtn"); newPostBtn.CssClass = "newPostActive"; } } } else if (e.Item is TreeListEditFormInsertItem) { /* If a new discussion is to be created, the post type can only be issue*/ if (DebateList.IsItemInserted) { TreeListEditFormInsertItem itm = e.Item as TreeListEditFormInsertItem; RadioButton Issue = (itm.FindControl("IssueRadio") as RadioButton); RadioButton Alter = (itm.FindControl("AlterRadio") as RadioButton); RadioButton Pro = (itm.FindControl("ProRadio") as RadioButton); RadioButton Con = (itm.FindControl("ConRadio") as RadioButton); RadioButton Comment = (itm.FindControl("CommentRadio") as RadioButton); Comment.Checked = false; Issue.Checked = true; Alter.Enabled = false; Pro.Enabled = false; Con.Enabled = false; Comment.Enabled = false; } } }
protected void radTreeResults_ItemDataBound(object sender, TreeListItemDataBoundEventArgs e) { if (!(e.Item is TreeListDataItem)) return; if (SessionObject.TeacherPortal_assessmentData2 == null) return; if (SessionObject.TeacherPortal_resultsData == null) return; var resultsData = SessionObject.TeacherPortal_resultsData; var assessmentData2 = SessionObject.TeacherPortal_assessmentData2; var cellIndex = e.Item.Cells.Count - assessmentData2.Rows.Count; if (cellIndex < 0) return; var dataItem = (DataRowView)((TreeListDataItem)e.Item).DataItem; foreach (DataRow test in assessmentData2.Rows) { foreach (DataRow r in resultsData.Rows) { if (dataItem["Level"].Equals(r["Level"]) && dataItem["LevelID"].Equals(r["LevelID"]) && r["TestID"].Equals(test["ID"])) { e.Item.Cells[cellIndex].Text = r["Score"].ToString(); e.Item.Cells[cellIndex].BackColor = System.Drawing.Color.FromName(r["PLevel"].ToString()); break; } } cellIndex++; } }