protected void RadTreeList1_ItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e) { if (e.Item is Telerik.Web.UI.TreeListDataItem) { Telerik.Web.UI.TreeListDataItem item = (Telerik.Web.UI.TreeListDataItem)e.Item; System.Data.DataRowView row = (System.Data.DataRowView)item.DataItem; string cssClass = ""; int width = 160; if (row.Row["LVL_UNIT"].ToString() == "LV3") { cssClass = "item-level2"; width = 180; } if (row.Row["LVL_UNIT"].ToString() == "LV2" || row.Row["KD_PARENT"] == "") { cssClass = "item-level1"; width = 200; } if (cssClass != "") { item.CssClass += cssClass; } Telerik.Web.UI.RadProgressBar rpb = (Telerik.Web.UI.RadProgressBar)item["PROGRESSBAR"].FindControl("ProgressBar1"); if (rpb != null) { int angka1 = Convert.ToInt32(row.Row["TOTAL_RKP"]); int angka2 = Convert.ToInt32(row.Row["TOTAL_EMPLOYEE"]); float persentase = 0; if (angka2 != 0) { persentase = ((float)angka1 / (float)angka2) * 100; } rpb.Value = persentase; rpb.Label = ((int)persentase).ToString() + "%"; int groupClass = (int)System.Math.Floor(persentase / 20) * 20; rpb.CssClass = "ProgressBar" + groupClass.ToString(); rpb.Width = Unit.Pixel(width); } } }
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; } } }