protected void DebateList_ItemCommand(object source, TreeListCommandEventArgs e) { if (e.CommandName == "replyMessage") { if (e.Item is TreeListDetailTemplateItem) { TreeListDetailTemplateItem itm = e.Item as TreeListDetailTemplateItem; if (!Request.IsAuthenticated) { needLoginLblTop.Visible = true; needLoginLblBottom.Visible = true; needLoginLblTop.Text = "<div class='dnnFormMessage dnnFormWarning'>" + Localization.GetString("LoggedIn", LocalResourceFile) + " <a href='" + ConfigurationManager.AppSettings["DomainName"] + /*"/" + * System.Threading.Thread.CurrentThread.CurrentCulture.Name +*/ "/login.aspx?returnurl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery) + "'>" + Localization.GetString("Login", LocalResourceFile) + "</a></div>"; needLoginLblBottom.Text = needLoginLblTop.Text; } else { itm.CssClass = "whiteBack"; LinkButton newPostBtn = (LinkButton)itm.FindControl("newPostBtn"); newPostBtn.CssClass = "newPostActive"; TreeListDataItem parentPost = itm.ParentItem; parentPost.IsChildInserted = true; DebateList.Rebind(); } } } }
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"; } }
public void btnSave_Click_FeatureServiceIdAndFeatureIdAboveZero_SaveFeatureMap() { //Arrange const string ServiceIdColumn = "ServiceID"; const string FeatureIdCollumn = "ServiceFeatureID"; const string MapIdColumn = "MAPID"; const string IsAdditionalCostColumn = "IsAdditionalCost"; const string IdColumn = "ID"; var item = new TreeListDataItem(_tlClientGroupServiceFeatures, 0, false); var serviceId = GetAnyNumber(); var featureId = GetAnyNumber(); var mapId = GetAnyNumber(); var row = new Dictionary <string, string> { { ServiceIdColumn, serviceId.ToString() }, { FeatureIdCollumn, featureId.ToString() }, { MapIdColumn, mapId.ToString() }, { IsAdditionalCostColumn, GetAnyNumber().ToString() }, { IdColumn, $"S{serviceId}" } }; item.ExtractValues(row); _tlClientGroupServiceFeatures.Items.Add(item); item.Selected = true; ShimTreeListDataItem.AllInstances.ItemGetString = (instance, key) => { return(new TableCell { Text = row[key] }); }; //Act CallbtnSave_Click(); //Assert _clientGroupServiceFeatureMapPassedToSave.ShouldSatisfyAllConditions( () => _clientGroupServiceFeatureMapPassedToSave.ShouldNotBeNull(), () => _clientGroupServiceFeatureMapPassedToSave.ClientGroupServiceFeatureMapID.ShouldBe(mapId), () => _clientGroupServiceFeatureMapPassedToSave.ServiceID.ShouldBe(serviceId), () => _clientGroupServiceFeatureMapPassedToSave.ServiceFeatureID.ShouldBe(featureId)); }
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 RadTreeList1_DeleteCommand(object sender, TreeListCommandEventArgs e) { TreeListDataItem item = e.Item as TreeListDataItem; if (item.CanExpand) { RadAjaxPanel1.Alert("Cần xóa hết các đơn vị con trong đơn vị này trước"); e.Canceled = true; return; } var iD = Convert.ToInt32(item.GetDataKeyValue("IDCoCauToChuc")); CoCauToChuc obj = _entities.CoCauToChucs.Where(o => o.IDCoCauToChuc == iD).First(); _entities.CoCauToChucs.DeleteObject(obj); _entities.SaveChanges(); }
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 ChkEliminar_CheckedChanged(object sender, EventArgs e) { CheckBox ChkEliminar = (CheckBox)sender; TreeListDataItem item = (TreeListDataItem)ChkEliminar.Parent.Parent; TableCell cell = item["FormaId"]; int Permiso = 0; if (ChkEliminar.Checked == true) { Permiso = 1; } else { Permiso = 0; } ClUsuario.Actualiza_Rol_Usuario(Convert.ToInt32(TxtUsuarioId.Text), Convert.ToInt32(cell.Text), Permiso, 4); }
private void SetUpRadTreeList(int serviceFeatureMapId, int featureId, int serviceId) { _tlClientGroupServiceFeatures = Get <RadTreeList>(_privateTestObject, "tlSecurityGroupAccess"); const string ServiceIdColumn = "ServiceID"; const string FeatureIdCollumn = "ServiceFeatureID"; const string MapIdColumn = "MAPID"; const string ServiceFeatureAccessMapIDColumn = "ServiceFeatureAccessMapID"; const string IdColumn = "ID"; var item = new TreeListDataItem(_tlClientGroupServiceFeatures, 0, false); var mapId = GetAnyNumber(); var row = new Dictionary <string, string> { { ServiceIdColumn, serviceId.ToString() }, { FeatureIdCollumn, featureId.ToString() }, { MapIdColumn, mapId.ToString() }, { ServiceFeatureAccessMapIDColumn, serviceFeatureMapId.ToString() }, { IdColumn, $"S{serviceId}" } }; item.ExtractValues(row); _tlClientGroupServiceFeatures.Items.Add(item); item.Selected = true; ShimTreeListDataItem.AllInstances.ItemGetString = (instance, key) => { return(new TableCell { Text = row[key] }); }; }
protected void RadTreeList1_DeleteCommand(object sender, TreeListCommandEventArgs e) { TreeListDataItem item = (TreeListDataItem)e.Item; foreach (var child in item.ChildItems) { var index = IncluirItens.IndexOf(IncluirItens.Single(i => i.id == int.Parse(child["id"].Text) && i.id_proteina == int.Parse(child["id_proteina"].Text))); IncluirItens.RemoveAt(index); } IncluirItens.RemoveAt(item.DataItemIndex); //soma e apresenta total na treeList SomaTotal(); RadTreeList1.Rebind(); //btnOk.OnClientClicking = "windowConfirmacao"; }
private void ConfigureRadTreeListControl(string defaultColumnValues = "1") { var radTreeList = Get <RadTreeList>(_privateTestObj, "tlClientServiceFeatures"); radTreeList.ClearSelectedItems(); radTreeList.DataKeyNames = new[] { "ID" }; radTreeList.ParentDataKeyNames = new[] { "PID" }; var dataItem = new TreeListDataItem(new RadTreeList(), 1, false) { DataItem = new ServiceFeatures.ClientGroupTreeListRow { ID = "1", PID = "1", ServiceFeatureID = 1, MAPID = 1, ServiceID = 1, IsAdditionalCost = true, Description = "sampleDescription", ServiceName = "SampleServiceName", IsEnabled = true, ServiceDisplayOrder = 1, ServiceFeatureDisplayOrder = 1, ServiceFeatureName = "sample" }, }; radTreeList.Items.Add(dataItem); ShimTreeListDataItem.AllInstances.ItemGetString = (x, colName) => { if (colName == "ServiceFeatureID") { return(new TableCell { Text = defaultColumnValues }); } return(new TableCell() { Text = "1" }); }; }
/***************** 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; } } }
void TreePermisos_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e) { if (e.Item.ItemType == TreeListItemType.Item || e.Item.ItemType == TreeListItemType.AlternatingItem) { TreeListDataItem item = e.Item as TreeListDataItem; TableCell cell = item["Consultar"]; string ConsultarVal = cell.Text; CheckBox Consultar; Consultar = (CheckBox)item.FindControl("ChkConsultar"); if (ConsultarVal == "1") { Consultar.Checked = true; } if (TxtEditar.Text == "0") { Consultar.Enabled = false; } TableCell cellIns = item["Insertar"]; string InsertarVal = cellIns.Text; CheckBox Insertar; Insertar = (CheckBox)item.FindControl("ChkInsertar"); if (InsertarVal == "1") { Insertar.Checked = true; } if (TxtEditar.Text == "0") { Insertar.Enabled = false; } TableCell cellEdit = item["Editar"]; string EditarVal = cellEdit.Text; CheckBox Editar; Editar = (CheckBox)item.FindControl("ChkEditar"); if (EditarVal == "1") { Editar.Checked = true; } if (TxtEditar.Text == "0") { Editar.Enabled = false; } TableCell cellEliminar = item["Eliminar"]; string EliminarVal = cellEliminar.Text; CheckBox Eliminar; Eliminar = (CheckBox)item.FindControl("ChkEliminar"); if (EliminarVal == "1") { Eliminar.Checked = true; } if (TxtEditar.Text == "0") { Eliminar.Enabled = false; } } }