protected void grdFaturaTarihce_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; using (Service1Client proxy = new Service1Client()) { if (!proxy.IstIdDahaOnceBolunmusBirFaturaKapsaminaAlinmimi(int.Parse(dataItem["ISTID"].Text))) { dataItem["Cikart"].Enabled = false; dataItem["Cikart"].ToolTip = "Bölünmüş fatura kapsamında değil. Çıkartma işlemi yapılamaz!"; } } if (dataItem["EkBolgemi"].Text == "False") { dataItem["EkBolgemi"].BackColor = System.Drawing.Color.Bisque; dataItem["EkBolgemi"].Text = "Hayır"; dataItem["EkBolgemi"].ToolTip = "Ek bölge değil"; } if (dataItem["EkBolgemi"].Text == "True") { dataItem["EkBolgemi"].BackColor = System.Drawing.Color.LightSalmon; dataItem["EkBolgemi"].Text = "Evet"; dataItem["EkBolgemi"].ToolTip = "Ek bölge"; } //dataItem["PAKETNOID"].ForeColor = System.Drawing.Color.Red; } }
protected void OnGridSituationCivilItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeleteSituationCivilColumn"].Controls[1] as LinkButton; ParamSituationCivil situationCivil = (ParamSituationCivil)e.Item.DataItem; buttonDelete.CommandArgument = situationCivil.Code; buttonDelete.Text = ResourceManager.GetString("deleteText"); if (situationCivil.NumberIDUsed > 0) { buttonDelete.OnClientClick = string.Format("javascript:alert('{0}'); return false;", ResourceManager.GetString("messageSituationCivilBeingUsed")); } else { buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; } LinkButton buttonEdit = dataItem["TemplateEditSituationCivilColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamSituationCivil situationCivil = e.Item.DataItem as ParamSituationCivil; if (situationCivil != null) { LinkButton lnkSituationCivilEdit = (LinkButton)e.Item.FindControl("lnkSituationCivilEdit"); if (lnkSituationCivilEdit != null) { lnkSituationCivilEdit.OnClientClick = string.Format("return OnSituationCivilEditClientClicked('{0}')", situationCivil.Code); } } } }
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridNestedViewItem) { var nestedItem = (GridNestedViewItem)e.Item; var hdnOrderID = (HiddenField)nestedItem.FindControl("hdnOrderID"); var hdnBillingAddressID = (HiddenField)nestedItem.FindControl("hdnBillingAddressID"); var hdnShippingAddressID = (HiddenField)nestedItem.FindControl("hdnShippingAddressID"); hdnOrderID.Value = nestedItem.ParentItem["OrderID"].Text; hdnBillingAddressID.Value = nestedItem.ParentItem["BillingAddressID"].Text; hdnShippingAddressID.Value = nestedItem.ParentItem["ShippingAddressID"].Text; var lvOrderDetail = (RadListView)nestedItem.FindControl("lvOrderDetail"); var OdsOrderDetail = (ObjectDataSource)nestedItem.FindControl("OdsOrderDetail"); lvOrderDetail.DataSourceID = OdsOrderDetail.ID; var fvBillingAddress = (FormView)nestedItem.FindControl("fvBillingAddress"); var OdsBillingAddress = (ObjectDataSource)nestedItem.FindControl("OdsBillingAddress"); fvBillingAddress.DataSourceID = OdsBillingAddress.ID; var fvShippingAddress = (FormView)nestedItem.FindControl("fvShippingAddress"); var OdsShippingAddress = (ObjectDataSource)nestedItem.FindControl("OdsShippingAddress"); fvShippingAddress.DataSourceID = OdsShippingAddress.ID; } }
protected void OnItemDataBound(object sender, GridItemEventArgs e) { if(e.Item is GridDataItem) { GridDataItem oDataItem = e.Item as GridDataItem; } }
protected void GridInvoices_ItemCreated(object sender, GridItemEventArgs e) { // Set the images for the status indicators. const string imageUrlTodo = "~/Images/Public/Fugue/icons-shadowless/minus-small.png"; const string imageUrlTick = "~/Images/Public/Fugue/icons-shadowless/tick.png"; const string imageUrlFail = "~/Images/Public/Fugue/icons-shadowless/cross-circle-frame.png"; if (e.Item is GridDataItem) { OutboundInvoice invoice = (OutboundInvoice)e.Item.DataItem; if (invoice == null) { return; } Image imagePaid = (Image)e.Item.FindControl("ImagePaidClosed"); imagePaid.ImageUrl = invoice.Open ? imageUrlTodo : imageUrlTick; HyperLink editLink = (HyperLink)e.Item.FindControl("LinkEdit"); editLink.Attributes["href"] = "http://data.piratpartiet.se/Forms/DisplayOutboundInvoice.aspx?Reference=" + invoice.Reference + "&Culture=" + (invoice.Domestic? invoice.Organization.DefaultCountry.Culture.Replace("-", "").ToLower(): "enus"); } }
protected void OnGridKnowledgeItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeleteKnowledgeColumn"].Controls[1] as LinkButton; ParamKnowledge knowledge = (ParamKnowledge)e.Item.DataItem; buttonDelete.CommandArgument = knowledge.KnowledgeID.ToString(); buttonDelete.Text = ResourceManager.GetString("deleteText"); if (knowledge.NumberIDUsed > 0) { buttonDelete.OnClientClick = string.Format("javascript:alert('{0}'); return false;", ResourceManager.GetString("messageKnowledgeBeingUsed")); } else { buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; } LinkButton buttonEdit = dataItem["TemplateEditKnowledgeColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamKnowledge knowledge = e.Item.DataItem as ParamKnowledge; if (knowledge != null) { LinkButton lnkKnowledgeEdit = (LinkButton)e.Item.FindControl("lnkKnowledgeEdit"); if (lnkKnowledgeEdit != null) { lnkKnowledgeEdit.OnClientClick = string.Format("return OnKnowledgeEditClientClicked('{0}')", knowledge.KnowledgeID); } } } }
protected void OnGridPermissionItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeletePermissionColumn"].Controls[1] as LinkButton; ParamPermission permission = (ParamPermission)e.Item.DataItem; buttonDelete.CommandArgument = permission.PermissionCode; buttonDelete.Text = ResourceManager.GetString("deleteText"); if (permission.NbrUserUsed > 0) { buttonDelete.OnClientClick = string.Format("javascript:alert('{0}'); return false;", ResourceManager.GetString("messagePermissionBeingUsed")); } else { buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; } LinkButton buttonEdit = dataItem["TemplateEditPermissionColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamPermission per = e.Item.DataItem as ParamPermission; if (per != null) { LinkButton lnkPermissionEdit = (LinkButton)e.Item.FindControl("lnkPermissionEdit"); if (lnkPermissionEdit != null) { lnkPermissionEdit.OnClientClick = string.Format("return OnPermissionEditClientClicked('{0}')", per.PermissionCode); } } } }
protected void OnGridFunctionFamItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeleteFunctionFamColumn"].Controls[1] as LinkButton; ParamFunctionFam functionFam = (ParamFunctionFam)e.Item.DataItem; buttonDelete.CommandArgument = functionFam.FonctionFamID; buttonDelete.Text = ResourceManager.GetString("deleteText"); if (functionFam.NumberIDUsed > 0) { buttonDelete.OnClientClick = string.Format("javascript:alert('{0}'); return false;", ResourceManager.GetString("messageFunctionFamBeingUsed")); } else { buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; } LinkButton buttonEdit = dataItem["TemplateEditFunctionFamColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamFunctionFam functionFam = e.Item.DataItem as ParamFunctionFam; if (functionFam != null) { LinkButton lnkFunctionFamEdit = (LinkButton)e.Item.FindControl("lnkFunctionFamEdit"); if (lnkFunctionFamEdit != null) { lnkFunctionFamEdit.OnClientClick = string.Format("return OnFunctionFamEditClientClicked('{0}')", functionFam.FonctionFamID); } } } }
protected void OnGridUnitItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeleteUnitColumn"].Controls[1] as LinkButton; ParamType unit = (ParamType)e.Item.DataItem; buttonDelete.CommandArgument = unit.TypeID; buttonDelete.Text = ResourceManager.GetString("deleteText"); buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; LinkButton buttonEdit = dataItem["TemplateEditUnitColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamType unit = e.Item.DataItem as ParamType; if (unit != null) { LinkButton lnkUnitEdit = (LinkButton)e.Item.FindControl("lnkUnitEdit"); if (lnkUnitEdit != null) { lnkUnitEdit.OnClientClick = string.Format("return OnUnitEditClientClicked('{0}')", unit.TypeID); } } } }
protected void grdVendorCategory_ItemDataBound(object sender, GridItemEventArgs e) { //if (e.Item is GridDataItem) //{ // GridDataItem item = e.Item as GridDataItem; // foreach (GridColumn column in item.OwnerTableView.RenderColumns) // { // if (column.UniqueName == "ContactPhone" || // column.UniqueName == "ContactDesignation") // { // TextBox tbEditBox = new TextBox(); // tbEditBox.Text = item[column].Text; // //tbEditBox.CssClass = "gridEditItem"; // //tbEditBox.Width = Unit.Pixel(50); // tbEditBox.TextChanged += new EventHandler(tbEditBox_TextChanged); // tbEditBox.AutoPostBack = true; // item[column].Controls.Clear(); // item[column].Controls.Add(tbEditBox); // } // } //} }
protected void GridExpenseClaims_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { ExpenseClaim claim = (ExpenseClaim) e.Item.DataItem; if (claim == null) { return; } Controls_v4_DocumentList docList = (Controls_v4_DocumentList) e.Item.FindControl("DocumentListClaim"); if (docList != null) { docList.Documents = Documents.ForObject(claim); } HyperLink editLink = (HyperLink)e.Item.FindControl("LinkEdit"); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowExpenseClaimForm('{0}','{1}');", claim.Identity, e.Item.ItemIndex); } }
protected void GridPeople_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowManageForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex][ "Identity"], e.Item.ItemIndex); Label labelGeography = (Label)e.Item.FindControl("LabelGeography"); Person currentPerson = e.Item.DataItem as Person; if (currentPerson != null) { string geographyName = currentPerson.Country.Code + "-" + currentPerson.PostalCode; geographyName += " " + currentPerson.Geography.Name; if (currentPerson.Geography.ParentGeographyId != 0) { geographyName += ", " + currentPerson.Geography.Parent.Name; } labelGeography.Text = geographyName; } } }
/* protected void PopulateGrid (int accountId, DateTime start, DateTime end) { if (accountId == 0) { return; } FinancialAccount account = FinancialAccount.FromIdentity(accountId); DateTime balanceStart = new DateTime(DateTime.Today.Year, 1, 1); if (account.AccountType == FinancialAccountType.Asset || account.AccountType == FinancialAccountType.Debt) { balanceStart = new DateTime(2006, 1, 1); // The dawn of mankind, for our purposes } currentAccountBalance = account.GetDelta(balanceStart, start.AddSeconds(-1)); // We use "AddDays (1)" onto the end date, as the underlying select works like this: // "get rows where datetime >= start or datetime < end" // This assures us that the dates given in the interface make an inclusive range. this.GridTransactions.DataSource = FinancialAccount.FromIdentity(accountId).GetRows(start, end.AddDays(1)); } protected void PopulateAccounts() { int organizationId = Organization.PPSEid; // TODO: Get from a future dropdown FinancialAccounts accounts = FinancialAccounts.ForOrganization(organizationId); this.DropAccounts.Items.Add(new ListItem("-- Select account --", "0")); this.DropAccountsCreate.Items.Add(new ListItem("-- Select account --", "0")); foreach (FinancialAccount account in accounts) { this.DropAccounts.Items.Add(new ListItem(account.Name, account.Identity.ToString())); this.DropAccountsCreate.Items.Add(new ListItem(account.Name, account.Identity.ToString())); } }*/ protected void GridReporters_ItemCreated (object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { Reporter reporter = e.Item.DataItem as Reporter; if (reporter == null) { return; } /* HyperLink editLink = (HyperLink) e.Item.FindControl("ManageLink"); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowTransactionForm('{0}','{1}');", row.FinancialTransactionId, e.Item.ItemIndex);*/ Label labelCategories = (Label) e.Item.FindControl("LabelCategories"); List<string> categoryNames = new List<string>(); foreach (MediaCategory mediaCategory in reporter.MediaCategories) { categoryNames.Add(mediaCategory.Name); } labelCategories.Text = String.Join(", ", categoryNames.ToArray()); } }
/// <summary> /// Handles the ItemCreated event of the AppointmentTypesGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> private static void AppointmentTypesGridItemCreated(object sender, GridItemEventArgs e) { var commandItem = e.Item as GridCommandItem; if (commandItem != null) { // control names from http://www.telerik.com/help/aspnet-ajax/grddefaultbehavior.html commandItem.FindControl("RefreshButton").Visible = false; commandItem.FindControl("RebindGridButton").Visible = false; } else { var editableItem = e.Item as GridEditableItem; if (editableItem != null && e.Item.IsInEditMode) { const int EnterKey = 13; ClientAPI.RegisterKeyCapture( editableItem["Name"].Controls.OfType<TextBox>().Single(), editableItem["EditButtons"].Controls[0], EnterKey); } else { var normalItem = e.Item as GridDataItem; if (normalItem != null && e.Item.DataItem != null) { ////var category = (AppointmentType)e.Item.DataItem; ////normalItem["Delete"].Controls.OfType<LinkButton>().Single().Visible = category.EventCount == 0; } } } }
protected void grdIndexFields_ItemDataBound(object sender, GridItemEventArgs e) { if(e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditableItem item = e.Item as GridEditableItem; // access/modify the edit item template settings here RadComboBox list = item.FindControl("ddlFormFields") as RadComboBox; //decimal ffID = (item.DataItem as IndexField).FormFieldID; int formID = Convert.ToInt32(ddlForms.SelectedValue); GRASPEntities db = new GRASPEntities(); List<FormField> ffs = (from f in db.FormField where f.form_id == formID && f.type != "SEPARATOR" && f.type != "TRUNCATED_TEXT" && f.type != "WRAPPED_TEXT" && f.type != "REPEATABLES_BASIC" && f.type != "REPEATABLES" orderby f.positionIndex select f).ToList(); list.DataSource = ffs; list.DataBind(); //if(Session["updatedValue"] != null) //{ // list.SelectedValue = Session["updatedValue"].ToString(); //} } else if(e.Item is GridDataItem && !e.Item.IsInEditMode && Page.IsPostBack) { //GridDataItem item = e.Item as GridDataItem; //Label label = item.FindControl("lblFormFieldName") as Label; //// update the label value //label.Text = Session["updatedValue"].ToString(); } }
protected void SetRTIImage_GraphicView(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; Image rtiImage = (Image)item.FindControl("GraphicViewRTIImage"); Image studentImage = (Image)item.FindControl("StudentPhoto"); Image SummaryIcon = (Image)item.FindControl("GraphicViewSummaryIcon"); SummaryIcon.Visible = UserHasPermission(Base.Enums.Permission.Icon_Summary_Student); DataRowView itemDataRow = (DataRowView)item.DataItem; //RTI Image Path string rtiImageURL = (String.IsNullOrEmpty(itemDataRow.Row["rtiimg"].ToString()) ? "" : itemDataRow.Row["rtiimg"].ToString()); //Student Image Path string imgName = itemDataRow.Row["picture"].ToString(); //Default if it's null in the DB, or missing from the web server path if (String.IsNullOrEmpty(imgName) || !File.Exists(Server.MapPath(AppSettings.ProfileImageStudentWebPath + "/" + imgName))) { studentImage.ImageUrl = ResolveUrl("~/Images/new/male_student.png"); } else studentImage.ImageUrl = AppSettings.ProfileImageStudentWebPath + '/' + imgName; if (rtiImage != null && rtiImageURL.Length > 0 && rtiImageURL.IndexOf("blank") == -1) { rtiImage.ImageUrl = "~/Images/" + rtiImageURL; } } else if (e.Item is GridEditFormItem) { GridEditFormItem item = (GridEditFormItem)e.Item; } }
protected void OnGridUserItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; LinkButton buttonDelete = dataItem["TemplateDeleteUserColumn"].Controls[1] as LinkButton; //buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; buttonDelete.CommandArgument = ((ParamUser)e.Item.DataItem).UserID; buttonDelete.Text = ResourceManager.GetString("deleteText"); int count = new ParamUserRepository().CountNumberBeingUsedOfUser(buttonDelete.CommandArgument); if (count > 0) { buttonDelete.OnClientClick = string.Format("javascript:alert('{0}'); return false;", ResourceManager.GetString("messageUserBeingUsed")); } else { buttonDelete.OnClientClick = "return confirm('" + ResourceManager.GetString("deleteConfirmText") + "')"; } LinkButton buttonEdit = dataItem["TemplateEditUserColumn"].Controls[1] as LinkButton; buttonEdit.Text = ResourceManager.GetString("editText"); } if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { ParamUser user = e.Item.DataItem as ParamUser; if(user != null) { LinkButton lnkUserEdit = (LinkButton)e.Item.FindControl("lnkUserEdit"); if (lnkUserEdit != null) { lnkUserEdit.OnClientClick = string.Format("return OnUserEditClientClicked('{0}')", user.UserID); } } } }
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridFooterItem && RadGrid1.MasterTableView.IsItemInserted) { e.Item.Visible = false; } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { DataTable dt = new DataTable(); string str = ""; int it = 0; dt.Columns.Add(new DataColumn("Answer", str.GetType())); dt.Columns.Add(new DataColumn("Count", it.GetType())); GridDataItem item = (GridDataItem)e.Item; RadChart rc = item.FindControl("RadChart1") as RadChart; long qsid = long.Parse(item["QSID"].Text); Model.Question qsM = qn.GetQsModel(qsid); int[] qsAcc = ua.CountAnswers(qsM.ID); int maxcount = 0; for (int i = 0; i < qsM.Answer.Length; i++) { DataRow dr = dt.NewRow(); dr["Answer"] = qsM.Answer[i]; dr["Count"] = qsAcc[i]; dt.Rows.Add(dr); maxcount += qsAcc[i]; } rc.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false; rc.PlotArea.Appearance.FillStyle.MainColor = Color.AliceBlue; rc.PlotArea.Appearance.FillStyle.SecondColor = Color.AliceBlue; rc.PlotArea.YAxis.MaxValue = maxcount; rc.ChartTitle.TextBlock.Text = ""; rc.DataSource = dt; rc.DataBind(); } }
protected void grdIstIdninImzaileIlgiliBelgeleri2_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; Label lblKimlerImzalamis = (Label)item.FindControl("lblImzalayanlar"); EFDal ed=new EFDal(); string path = ed.ImzaliDosyalarIddenPathDon(Convert.ToInt32(item["Id"].Text)); //lblKimlerImzalamis.Text= ed.SignersInfo(path); item["Imzalayan"].Text = ed.SignersInfo(path); item["Imzalayan"].ForeColor = System.Drawing.Color.Red; if (item["Imzalayan"].Text == "00000000-0000-0000-0000-000000000000" || item["Imzalayan"].Text == " ") { item["Imzalayan"].BackColor = System.Drawing.Color.Gainsboro; item["Imzalayan"].Text = "İmzalanmamış"; } else { item["Imzalayan"].BackColor = System.Drawing.Color.LightYellow; } using (Service1Client proxy = new Service1Client()) { item["Yukleyen"].Text = proxy.kal_UserIddenUserNameDon(Guid.Parse(item["Yukleyen"].Text)); } item["DokumanTipi"].Text = ed.DokumanTipiIddenDokumanAdiDon(Convert.ToInt32(item["DokumanTipi"].Text)); } }
public static void itemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { e.Item.Style["cursor"] = "hand"; //' Cursor } }
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { GridEditableItem item = e.Item as GridEditableItem; RadUpload upload = (item.EditManager.GetColumnEditor("AttachmentColumn") as GridAttachmentColumnEditor).RadUploadControl; upload.OnClientFileSelected = "uploadFileSelected"; } }
protected void GridInvoices_ItemCreated(object sender, GridItemEventArgs e) { // Set the images for the status indicators. const string imageUrlTodo = "~/Images/Public/Fugue/icons-shadowless/minus-small.png"; const string imageUrlTick = "~/Images/Public/Fugue/icons-shadowless/tick.png"; const string imageUrlFail = "~/Images/Public/Fugue/icons-shadowless/cross-circle-frame.png"; if (e.Item is GridDataItem) { InboundInvoice invoice = (InboundInvoice)e.Item.DataItem; if (invoice == null) { return; } Controls_v4_DocumentList docList = (Controls_v4_DocumentList)e.Item.FindControl("DocumentList"); if (docList != null) { docList.Documents = Documents.ForObject(invoice); } Image imageAttested = (Image)e.Item.FindControl("ImageAttested"); Image imagePaid = (Image)e.Item.FindControl("ImageClosedPaid"); imageAttested.ImageUrl = invoice.Attested ? imageUrlTick : imageUrlTodo; if (invoice.Open == false) { imagePaid.ImageUrl = invoice.Attested ? imageUrlTick : imageUrlFail; } else { imagePaid.ImageUrl = imageUrlTodo; } HyperLink editLink = (HyperLink)e.Item.FindControl("LinkEdit"); editLink.Attributes["href"] = "#"; if (invoice.Open) { editLink.Attributes["onclick"] = String.Format("return ShowInboundInvoiceForm('{0}','{1}');", invoice.Identity, e.Item.ItemIndex); } else { editLink.Visible = false; } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridCommandItem && !myIsAdmin) { Button addButton = e.Item.FindControl("AddNewRecordButton") as Button; addButton.Visible = false; LinkButton lnkButton = (LinkButton)e.Item.FindControl("InitInsertButton"); lnkButton.Visible = false; } }
protected void grdAssignments_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem gridItem = (GridDataItem)e.Item; HyperLink lnk = (HyperLink)gridItem["LnkLevelName"].Controls[0]; DataRowView row = (DataRowView)(gridItem).DataItem; lnk.NavigateUrl = "~/Record/Class.aspx?xID=" + row["ClassID_Encrypted"]; } }
protected void grdTeklifler_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink"); editLink.Attributes.Clear(); editLink.Attributes["href"] = "#"; editLink.Attributes["onclick"] = String.Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ID"], e.Item.ItemIndex); } }
protected void grdImzaBekleyenBelgeler_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; //Session["bak"] = Session["bak"].ToString()+ "," + dataItem["Id"].Text; HyperLink targetImza = e.Item.FindControl("lnkImzalamaSayfasi") as HyperLink; targetImza.NavigateUrl = "/sfKalibrasyon/UserControls/Pages/Imzala.aspx?IstId=" + dataItem["IstId"].Text; } }
protected void grdBill_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) e.Item.Attributes["onclick"] = "location='Bill.aspx?BillId=" + e.Item.DataItem.GetPropertyValue("BillId") + "';"; if (e.Item.ItemType == GridItemType.GroupFooter) { e.Item.Cells[e.Item.Cells.Count - 1].Visible = false; } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; if (item["IsReadCol"].Text == "False") { item.Font.Bold = true; } } }
protected void rgProject_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { var lkbDelete = (LinkButton)e.Item.FindControl("lkbDelete"); if (lkbDelete != null) { lkbDelete.Attributes.Add("onclick", string.Format("return deleteProject()")); } } }
protected void rg1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; Convenio conv = (Convenio)Session["Convenio" + Session.SessionID]; GridDataItem item = (GridDataItem)e.Item; if (conv.Pue_Admin1 != sesion.Id_U && conv.Pue_Admin2 != sesion.Id_U) { item["Atender"].Visible = false; } else { item["Editar"].Visible = false; item["Enviar"].Visible = false; item["Eliminar"].Visible = false; } } if (e.Item is GridHeaderItem) { Sesion sesion = (Sesion)Session["Sesion" + Session.SessionID]; Convenio conv = (Convenio)Session["Convenio" + Session.SessionID]; GridHeaderItem item = (GridHeaderItem)e.Item; if (conv.Pue_Admin1 != sesion.Id_U && conv.Pue_Admin2 != sesion.Id_U) { item["Atender"].Visible = false; } else { item["Editar"].Visible = false; item["Enviar"].Visible = false; item["Eliminar"].Visible = false; } } }
protected void RadGridReport_OnItemCreated(object sender, GridItemEventArgs e) { //if (e.Item is GridDataItem) //{ // GridDataItem item = (GridDataItem)e.Item; // foreach (TableCell cell in item.Cells) // { // cell.Style["font-family"] = "tahoma"; // cell.Style["text-align"] = "center"; // //cell.Style["font-size"] = (4 + e.Item.ItemIndex * 0.8) + "pt"; // } //} //else if (e.Item is GridHeaderItem) //{ // GridHeaderItem item = (GridHeaderItem)e.Item; // foreach (TableCell cell in item.Cells) // { // cell.Style["font-family"] = "tahoma"; // cell.Style["text-align"] = "center"; // //cell.Style["font-size"] = (4 + e.Item.ItemIndex * 0.8) + "pt"; // } //} }
protected void RadGrid2_OnItemDataBound(object sender, GridItemEventArgs e) { var cbohang = e.Item.FindControl("cbboxHang") as RadComboBox; if (cbohang != null) { var presenter = new PMHang(); var dshang = presenter.List(null); cbohang.DataTextField = "Ten"; cbohang.DataValueField = "ID"; cbohang.DataSource = dshang; cbohang.DataBind(); } if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { var item = (GridEditFormItem)e.Item; var combo = (RadComboBox)item.FindControl("cbboxHang"); if (!(e.Item is IGridInsertItem)) { combo.SelectedValue = DataBinder.Eval(item.DataItem, "ID_Hang").ToString(); } } }
protected void grdDevolucionSolicitud_ItemDataBound(object sender, GridItemEventArgs e) { if (Session["Usuario"] == null) { Response.Redirect("~/Security/frmCerrar.aspx"); } try { if (e.Item is GridDataItem) { GridDataItem dataItem = e.Item as GridDataItem; if (((CheckBox)dataItem["aprobacion1"].Controls[0]).Checked) { dataItem["Elim"].Controls[0].Visible = false; } if (((CheckBox)dataItem["GuiadoDev"].Controls[0]).Checked) { //((ImageButton)dataItem["Edit"].FindControl("ibDevolucion")).Visible = false; ((ImageButton)dataItem["Edit"].FindControl("ibDevolucion")).Visible = true; } else if (((CheckBox)dataItem["aprobacion1"].Controls[0]).Checked && !((Usuario_LoginResult)Session["Usuario"]).aprobarDevolucionSol1) { ((ImageButton)dataItem["Edit"].FindControl("ibDevolucion")).Visible = false; } } } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
protected void Grid_ItemDataBound(object sender, GridItemEventArgs e) { //if (e.Item.IsInEditMode) //{ // GridEditableItem editItem = (GridEditableItem)e.Item; // Button updateButton = (Button)editItem.FindControl("UpdateButton"); // Button CancelButton = (Button)editItem.FindControl("CancelButton"); // updateButton.Text = "save"; // CancelButton.Visible = false; //} if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; if (item["GroupsCounter"].Text != "0") { //LinkButton btn = (LinkButton)item["LnkDelete"].Controls[0]; LinkButton btn = e.Item.FindControl("LnkDelete") as LinkButton; btn.Enabled = false; btn.ToolTip = "Item cannot be deleled"; } } }
/// <summary> /// Handles the OnItemDataBound event of the rgProductPrice control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> protected void rgProductPrice_OnItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditFormItem) && e.Item.IsInEditMode) { var gridEditFormItem = (GridEditFormItem)e.Item; var rfv = (RequiredFieldValidator)gridEditFormItem["PriceListTitle"].FindControl("RequiredFieldValidator4"); rfv.InitialValue = Guid.Empty.ToString(); var ddlPriceList = (DropDownList)gridEditFormItem["PriceListTitle"].FindControl("ddlPriceList"); foreach (var v in dataManager.PriceList.SelectAll(SiteID).ToList()) { var priceListTitle = v.Title + "(" + v.tbl_PriceListType.Title + ")"; ddlPriceList.Items.Add(new ListItem(priceListTitle, v.ID.ToString())); } ddlPriceList.Items.Insert(0, new ListItem("Выберите значение", Guid.Empty.ToString())); var dcbSupplier = (DictionaryComboBox)gridEditFormItem["SupplierTitle"].FindControl("dcbSupplier"); dcbSupplier.SiteID = SiteID; //dcbSupplier.EditLink = UrlsData.AP_Company(Guid.Empty); dcbSupplier.BindData(); if (!(gridEditFormItem.DataItem is GridInsertionObject)) { var productComplectation = (ProductPriceStructure)gridEditFormItem.DataItem; if (productComplectation != null) { ddlPriceList.SelectedIndex = ddlPriceList.Items.IndexOf(ddlPriceList.Items.FindByValue(productComplectation.PriceListID.ToString())); dcbSupplier.SelectedIdNullable = productComplectation.SupplierID; } } } }
protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; User user = (User)e.Item.DataItem; string personId = ((HiddenField)item.FindControl("hfPersonId")).Value; bool isPrimaryExisting = false; string userName = string.Empty; if (user != null) { userName = (string.IsNullOrEmpty(user.Name)) ? string.Empty : user.Name; } //add primary site if any for the person Label primarySite = new Label(); primarySite = (Label)item.FindControl("lblPrimarySite"); primarySite.CssClass = "bold"; primarySite.Text = GetPrimarySite(personId); if (!string.IsNullOrEmpty(primarySite.Text)) { isPrimaryExisting = true; primarySite.Text += "<img src=../App_Themes/default/icons/star_16.png />"; } else { isPrimaryExisting = false; } //add secondary sites if any for the person. Label sites = new Label(); sites = (Label)item.FindControl("lblSecondarySites"); sites.Text = GetSecondarySites(personId, isPrimaryExisting); } }
/// <summary> /// Handles the OnItemDataBound event of the gridAccessProfileRecord control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> protected void gridAccessProfileRecord_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = (GridDataItem)e.Item; var data = (DataRowView)e.Item.DataItem; ((Literal)item.FindControl("litCompanyRule")).Text = EnumHelper.GetEnumDescription((AccessProfileRecordRule)int.Parse(data["tbl_AccessProfileRecord_CompanyRuleID"].ToString())); ((Literal)item.FindControl("litOwnerRule")).Text = EnumHelper.GetEnumDescription((AccessProfileRecordRule)int.Parse(data["tbl_AccessProfileRecord_OwnerRuleID"].ToString())); if (data["tbl_AccessProfileRecord_CompanyID"] != null && !string.IsNullOrEmpty(data["tbl_AccessProfileRecord_CompanyID"].ToString())) { var company = DataManager.Company.SelectById(SiteId, Guid.Parse(data["tbl_AccessProfileRecord_CompanyID"].ToString())); if (company != null) { ((Literal)item.FindControl("litCompany")).Text = company.Name; } } if (data["tbl_AccessProfileRecord_OwnerID"] != null && !string.IsNullOrEmpty(data["tbl_AccessProfileRecord_OwnerID"].ToString())) { var contact = DataManager.Contact.SelectById(SiteId, Guid.Parse(data["tbl_AccessProfileRecord_OwnerID"].ToString())); if (contact != null) { ((Literal)item.FindControl("litOwner")).Text = contact.UserFullName; } } var target = (LinkButton)e.Item.FindControl("lbEdit"); editRecordTooltip.TargetControls.Add(target.ClientID, data["ID"].ToString(), true); var lbDelete = (LinkButton)e.Item.FindControl("lbDelete"); lbDelete.CommandArgument = data["ID"].ToString(); lbDelete.Command += new CommandEventHandler(lbDelete_OnCommand); } }
/// <summary> /// Handles the OnItemDataBound event of the gridWorkflowTemplates control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> protected void gridWorkflowTemplates_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = (GridDataItem)e.Item; var data = (DataRowView)e.Item.DataItem; ((Literal)item.FindControl("lrlWorkflowTemplateStatus")).Text = EnumHelper.GetEnumDescription((WorkflowTemplateStatus)int.Parse(data["tbl_WorkflowTemplate_Status"].ToString())); ((HyperLink)item.FindControl("hlName")).Text = data["tbl_WorkflowTemplate_Name"].ToString(); if (allowWorkflowDesigner) { ((HyperLink)item.FindControl("hlName")).NavigateUrl = UrlsData.AP_WorkflowTemplateEdit(Guid.Parse(data["tbl_WorkflowTemplate_ID"].ToString())); } else { ((HyperLink)item.FindControl("hlName")).NavigateUrl = UrlsData.AP_WorkflowTemplateWizard(Guid.Parse(data["tbl_WorkflowTemplate_ID"].ToString())); } ((HyperLink)item.FindControl("hlEdit")).NavigateUrl = ((HyperLink)item.FindControl("hlName")).NavigateUrl; ((LinkButton)item.FindControl("lbCopy")).CommandArgument = data["tbl_WorkflowTemplate_ID"].ToString(); ((LinkButton)item.FindControl("lbCopy")).OnClientClick = string.Format("return confirm(\"Создать копию шаблона процесса '{0}' и перейти к редактированию?\");", data["tbl_WorkflowTemplate_Name"]); ((LinkButton)item.FindControl("lbDelete")).CommandArgument = data["tbl_WorkflowTemplate_ID"].ToString(); } }
protected void GridPayouts_ItemCreated(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { Payout payout = (Payout)e.Item.DataItem; if (payout == null) { return; } Label labelDueDate = (Label)e.Item.FindControl("LabelDueDate"); if (payout.ExpectedTransactionDate < DateTime.Now) { labelDueDate.Text = "ASAP"; } else { labelDueDate.Text = payout.ExpectedTransactionDate.ToString("yyyy-MM-dd"); } /* * Controls_v4_DocumentList docList = (Controls_v4_DocumentList) e.Item.FindControl("DocumentListClaim"); * * if (docList != null) * { * docList.Documents = Documents.ForObject(claim); * } * * HyperLink editLink = (HyperLink)e.Item.FindControl("LinkEdit"); * editLink.Attributes["href"] = "#"; * editLink.Attributes["onclick"] = String.Format("return ShowExpenseClaimForm('{0}','{1}');", * claim.Identity, e.Item.ItemIndex);*/ } }
protected void rgProfilePeriodList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; HiddenField hf; Label lbl; try { EHSProfilePeriod period = (EHSProfilePeriod)e.Item.DataItem; LinkButton lnk = (LinkButton)e.Item.FindControl("lnkPeriod"); lnk.Text = SQMBasePage.FormatDate(period.PeriodDate, "MMMM yyyy", false); lnk.CommandArgument = period.PeriodDate.ToShortDateString(); Ucl_MetricList ucl = (Ucl_MetricList)e.Item.FindControl("uclInputsList"); ucl.BindInputsList(period, ""); } catch (Exception ex) { } } }
protected void RadGridBoxes2_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem) { string tld = Session["tldReagent_id_isInterval"].ToString(); if (tld != "") { GridDataItem ditem = (GridDataItem)e.Item; string tldReagent_id = ditem.GetDataKeyValue("tldReagent_id").ToString(); if (tldReagent_id == tld) { ditem.BackColor = System.Drawing.ColorTranslator.FromHtml("#4F52BA"); ditem.ForeColor = Color.White; } } } } catch (Exception ex) { Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name); } }
protected void grdLetras_ItemDataBound(object sender, GridItemEventArgs e) { if (Session["Usuario"] == null) { Response.Redirect("~/Security/frmCerrar.aspx"); } try { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; var IsActivo = false; var estado = item["Estado"].Text; if (estado == "StandBy") { IsActivo = true; } if (IsActivo) { ((System.Web.UI.WebControls.Image)e.Item.FindControl("ibDesactivar")).ImageUrl = "~/Images/Icons/circle-red-16.png"; } else { ((System.Web.UI.WebControls.Image)e.Item.FindControl("ibDesactivar")).ImageUrl = "~/Images/Icons/circle-green-16.png"; } } } catch (Exception ex) { lblMensaje.Text = ex.Message; lblMensaje.CssClass = "mensajeError"; } }
/// <summary> /// Handles the ItemDataBound event of the CategoriesGrid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> private void CategoriesGrid_ItemDataBound(object sender, GridItemEventArgs e) { this.CreateExpandCollapseButton(e.Item, "Name"); if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) { var editedItem = e.Item as GridEditableItem; var category = e.Item.DataItem as Category; var dropDown = editedItem.FindControl("ParentCategoriesComboBox") as RadComboBox; if (dropDown != null) { var dataSource = (category != null) ? this.ParentCategories.Where( c => c.Id != category.Id) : this.ParentCategories; var filter = Utility.AddAncestorIds(this.CategoryIds.ToArray(), dataSource.ToArray(), false); dropDown.DataSource = dataSource.Where(c => !filter.Any() || filter.Contains(c.Id)); dropDown.DataBind(); dropDown.SelectedValue = (category != null && category.ParentId.HasValue) ? category.ParentId.Value.ToString(CultureInfo.CurrentCulture) : string.Empty; } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridEditableItem && e.Item.IsInEditMode) { var itemtype = e.Item.ItemType; var row = itemtype == GridItemType.EditFormItem ? (GridEditFormItem)e.Item : (GridEditFormInsertItem)e.Item; var FileImageName = (RadUpload)row.FindControl("FileImageName"); var ProjectCategoryID = ((HiddenField)row.FindControl("hdnProjectCategoryID")).Value; var dv = (DataView)ObjectDataSource1.Select(); var ddlParent = (RadComboBox)row.FindControl("ddlParent"); if (!string.IsNullOrEmpty(ProjectCategoryID)) { dv.RowFilter = "ProjectCategoryID = " + ProjectCategoryID; if (!string.IsNullOrEmpty(dv[0]["ParentID"].ToString())) { ddlParent.SelectedValue = dv[0]["ParentID"].ToString(); } } RadAjaxPanel1.ResponseScripts.Add(string.Format("window['UploadId'] = '{0}';", FileImageName.ClientID)); } }
protected void RadGridSuppliers_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is PatternSupplierBO) { PatternSupplierBO objSupplier = (PatternSupplierBO)item.DataItem; Literal litCountry = (Literal)item.FindControl("litCountry"); litCountry.Text = objSupplier.objCountry.ShortName.ToString(); HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); linkEdit.Attributes.Add("qid", objSupplier.ID.ToString()); linkEdit.Attributes.Add("cty", objSupplier.Country.ToString()); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); linkDelete.Attributes.Add("qid", objSupplier.ID.ToString()); linkDelete.Attributes.Add("cty", objSupplier.Country.ToString()); linkDelete.Visible = (objSupplier.PatternsWhereThisIsPatternSupplier.Count > 0) ? false : true; } } }
protected void EntriesGridItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.EditItem || e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.SelectedItem) { var entry = (ListEntryInfo)e.Item.DataItem; if (entry != null) { //Hide Edit option for system list var length = e.Item.Controls.Count; var editCommand = e.Item.Controls[length - 2].Controls[0] as ImageButton; if (editCommand != null) { editCommand.Visible = PortalSettings.ActiveTab.IsSuperTab || !(entry.SystemList || entry.PortalID == Null.NullInteger); } //Hide Delete option for system list var delCommand = e.Item.Controls[length - 1].Controls[0] as ImageButton; if (delCommand != null) { delCommand.Visible = PortalSettings.ActiveTab.IsSuperTab || !(entry.SystemList || entry.PortalID == Null.NullInteger); } } } }
protected void RadGridState_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem item) { if (item != null) { var cell = item["LastMessage"]; if (cell.Text.Length > MAXMESSAGELENGTH) { var originaltext = cell.Text; cell.Text = cell.Text.Substring(0, MAXMESSAGELENGTH) + "..."; cell.ToolTip = originaltext; } cell = item["InstanceNumber"]; if (cell.Text == "0") { cell.Text = ""; } cell = item["Type"]; if (cell.Text == "Database" || cell.Text == "FileServer" || cell.Text == "Maintenance" || cell.Text == "Unknown") { var cell2 = (ImageButton)e.Item.FindControl("ViewButton"); if (cell2 != null) { cell2.ImageUrl = "Images/empty.png"; } // cell2.Visible = false; // cell2.Text = ""; } } } }
//Setup in-grid links protected void rgSiteDetails_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; int site_id = Convert.ToInt32(item.GetDataKeyValue("site_id")); HyperLink hlSiteNo = (HyperLink)item.FindControl("hlSiteNo"); hlSiteNo.Attributes["target"] = "_blank"; hlSiteNo.Attributes["href"] = String.Format("{0}StationInfo.aspx?site_id={1}", Config.SIMSURL, site_id); } //Set custom column header tooltips if (e.Item is GridHeaderItem) { GridHeaderItem header = (GridHeaderItem)e.Item; header["sitefile_md"].ToolTip = "The date when data in the NWISWeb SITEFILE was last modified."; header["revised_dt"].ToolTip = "The date when an element in the manuscript was last modified."; header["approved_dt"].ToolTip = "The date when the manuscript was last approved."; header["needs_approval"].ToolTip = "A Manuscript requires approval when a manuscript element has been changed since the last approval date."; } }
public static void itemDataBound(object sender, GridItemEventArgs e, String urllink, String uniqueName) { Telerik.Web.UI.GridDataItem item; if (e.Item.ItemType == Telerik.Web.UI.GridItemType.Item || e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='" + "#E0E0E0" + "'"); if (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem) { e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='" + "#F7F7F7" + "'"); } else { e.Item.Attributes.Add("onmouseout", "this.style.backgroundColor='" + "white" + "'"); } item = e.Item as Telerik.Web.UI.GridDataItem; e.Item.Attributes.Add("onclick", "javascript:location.href='" + urllink + item[uniqueName].Text.Trim() + "';"); e.Item.Style["cursor"] = "hand"; //' Cursor } }
// client side validation function for branch form public void ValidateBranch(GridItemEventArgs e) { GridEditableItem editForm = (GridEditableItem)e.Item; ImageButton update = (ImageButton)editForm.FindControl("UpdateButton"); ImageButton insert = (ImageButton)editForm.FindControl("PerformInsertButton"); RadTextBox txtbrncod = (editForm.FindControl("txtbrncod") as RadTextBox); RadTextBox txtbrnds1 = (editForm.FindControl("txtbrnds1") as RadTextBox); if (update != null) { update.Attributes.Add("onclick", "return ValidateBranch('" + txtbrncod.ClientID + "','" + txtbrnds1.ClientID + "')"); } if (insert != null) { insert.Attributes.Add("onclick", "return ValidateBranch('" + txtbrncod.ClientID + "','" + txtbrnds1.ClientID + "')"); } }
protected void RadGridShipmentAddress_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { var item = e.Item as GridDataItem; if (item.ItemIndex > -1 && item.DataItem is DistributorClientAddressBO) { DistributorClientAddressBO objDistributorClientAddress = (DistributorClientAddressBO)item.DataItem; HyperLink linkEdit = (HyperLink)item.FindControl("linkEdit"); HyperLink linkDelete = (HyperLink)item.FindControl("linkDelete"); Literal litCountry = (Literal)item.FindControl("litCountry"); Literal litClient = (Literal)item.FindControl("litClient"); Literal litDistributor = (Literal)item.FindControl("litDistributor"); Literal litPort = (Literal)item.FindControl("litPort"); Literal litAddressType = (Literal)item.FindControl("litAddressType"); litCountry.Text = objDistributorClientAddress.objCountry.ShortName; litPort.Text = (objDistributorClientAddress.Port.HasValue && objDistributorClientAddress.Port > 0) ? objDistributorClientAddress.objPort.Name : string.Empty; if (objDistributorClientAddress.AddressType.HasValue) { litAddressType.Text = (objDistributorClientAddress.AddressType.Value == 1) ? "RESIDENTIAL" : "BUSINESS"; } litClient.Text = (objDistributorClientAddress.Client.HasValue && objDistributorClientAddress.Client > 0) ? objDistributorClientAddress.objClient.Name : string.Empty; litDistributor.Text = (objDistributorClientAddress.Distributor.HasValue && objDistributorClientAddress.Distributor > 0) ? objDistributorClientAddress.objDistributor.Name : string.Empty; linkEdit.Attributes.Add("qid", objDistributorClientAddress.ID.ToString()); linkDelete.Attributes.Add("qid", objDistributorClientAddress.ID.ToString()); linkDelete.Visible = (objDistributorClientAddress.OrdersWhereThisIsBillingAddress.Any() || objDistributorClientAddress.OrdersWhereThisIsDespatchToAddress.Any() || objDistributorClientAddress.OrderDetailsWhereThisIsDespatchTo.Any()) ? false : true; } } }
//行绑定事件 protected void RG_Report_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { #region “申报金额”>=1万元(绿色);“申报金额”>=10万元(黄色);“申报金额”>=100万元(紫色) var reportCost = DataBinder.Eval(e.Item.DataItem, "ReportCost"); if (decimal.Parse(reportCost.ToString()) >= 1000000) { e.Item.Style["color"] = "#CC00FF"; e.Item.Cells[2].Style["color"] = "black"; } else if (decimal.Parse(reportCost.ToString()) >= 100000) { e.Item.Style["color"] = "#FF9900"; e.Item.Cells[2].Style["color"] = "black"; } else if (decimal.Parse(reportCost.ToString()) >= 10000) { e.Item.Style["color"] = "#009900"; e.Item.Cells[2].Style["color"] = "black"; } #endregion } }
protected void rg_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; WebControl Button = default(WebControl); string clickHandler = ""; Button = (WebControl)item["BajaAdmin"].Controls[0]; clickHandler = Button.Attributes["onclick"]; Button.Attributes["onclick"] = clickHandler.Replace("[[ID]]", item.GetDataKeyValue("Id_Ped").ToString()); if (item.GetDataKeyValue("Ped_Tipo").ToString() == "3") { Button.Visible = false; } Button = (WebControl)item["BajaCliente"].Controls[0]; clickHandler = Button.Attributes["onclick"]; Button.Attributes["onclick"] = clickHandler.Replace("[[ID]]", item.GetDataKeyValue("Id_Ped").ToString()); if (item.GetDataKeyValue("Ped_Tipo").ToString() == "3") { Button.Visible = false; } Button = (WebControl)item["Imprimir"].Controls[0]; clickHandler = Button.Attributes["onclick"]; Button.Attributes["onclick"] = clickHandler.Replace("[[ID]]", item.GetDataKeyValue("Id_Ped").ToString()); } } catch (Exception ex) { ErrorManager(ex, new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name); } }
protected void grdDefenceList_OnItemDataBound(object sender, GridItemEventArgs e) { var status = Convert.ToInt32(ViewState["selectedState"]); var eItem = e.Item as GridDataItem; if (eItem == null) { return; } GridDataItem item = eItem; Button divApprove = (Button)item["operator"].FindControl("btnApprove"); Button divAvoid = (Button)item["operator"].FindControl("btnAvoid"); switch (status) { case 1: divApprove.Enabled = true; divAvoid.Enabled = false; break; case 2: divApprove.Enabled = false; divAvoid.Enabled = true; break; case 3: divApprove.Enabled = true; divAvoid.Enabled = false; break; case 4: divApprove.Enabled = false; divAvoid.Enabled = false; break; } }
void grdSummary_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridFooterItem) { Label lblTotalCountOfJobs = (Label)e.Item.FindControl("lblTotalCountOfJobs"); Label lblTotalCountOfExtras = (Label)e.Item.FindControl("lblTotalCountOfExtras"); Label lblTotalRate = (Label)e.Item.FindControl("lblTotalRate"); int totalCountOfJobs = 0; int totalCountOfExtras = 0; decimal totalRate = 0; foreach (DataRow row in AllUninvoicedWorkForOrganisation.Tables[1].Rows) { totalCountOfJobs += (int)row["CountOfJobs"]; totalRate += (decimal)row["Total Charge Amount"]; totalCountOfExtras += (int)row["CountOfExtras"]; } lblTotalCountOfJobs.Text = totalCountOfJobs.ToString(); lblTotalRate.Text = totalRate.ToString("C"); lblTotalCountOfExtras.Text = totalCountOfExtras.ToString(); } }
/// <summary> /// Handles the OnItemDataBound event of the gridSiteDomains control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.GridItemEventArgs"/> instance containing the event data.</param> protected void gridSiteDomains_OnItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { if (access == null) { access = Access.Check(); } var item = (GridDataItem)e.Item; var data = (DataRowView)e.Item.DataItem; ((Literal)item.FindControl("lrlSiteDomain")).Text = data["tbl_SiteDomain_Domain"].ToString(); ((Literal)item.FindControl("lrlSiteDomainStatus")).Text = EnumHelper.GetEnumDescription((SiteDomainStatus)int.Parse(data["tbl_SiteDomain_StatusID"].ToString())); if (!string.IsNullOrEmpty((string)data["tbl_SiteDomain_Aliases"])) { ((Literal)item.FindControl("lrlAliases")).Text = string.Format("Псевдонимы: {0}", data["tbl_SiteDomain_Aliases"]); } if (!string.IsNullOrEmpty((string)data["tbl_SiteDomain_Note"])) { ((Literal)item.FindControl("lrlNote")).Text = string.Format("Примечание: {0}", data["tbl_SiteDomain_Note"]); } ((LinkButton)e.Item.FindControl("lbEdit")).CommandArgument = data["ID"].ToString(); ((LinkButton)e.Item.FindControl("lbDelete")).CommandArgument = data["ID"].ToString(); ((LinkButton)e.Item.FindControl("lbCheck")).CommandArgument = data["ID"].ToString(); RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(e.Item.FindControl("lbCheck"), ucCheckSite); ((TextBox)item.FindControl("txtDomain")).Text = data["tbl_SiteDomain_Domain"].ToString(); ((TextBox)item.FindControl("txtAliases")).Text = data["tbl_SiteDomain_Aliases"].ToString(); ((RadButton)e.Item.FindControl("lbtnUpdate")).CommandArgument = data["ID"].ToString(); e.Item.FindControl("lbDelete").Visible = access.Delete; } }
protected void rdGridProyeccionPagos_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item = (GridDataItem)e.Item; DataRowView row = (DataRowView)e.Item.DataItem; if (!string.IsNullOrEmpty(Decimales)) { if (int.Parse(Decimales) > 0) { item["nMontoFactura"].Text = double.Parse(row["nMontoFactura"].ToString()).ToString("N" + Decimales); } else { item["nMontoFactura"].Text = double.Parse(row["nMontoFactura"].ToString()).ToString("N0"); } } else { item["nMontoFactura"].Text = double.Parse(row["nMontoFactura"].ToString()).ToString("N0"); } } }
protected void gvLegajos_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item) { TempSueldos contE = (TempSueldos)e.Item.DataItem; if (contE.PoseeInfoSueldo) { (e.Item.FindControl("lblInfoSueldos") as Label).Text = "Si"; } else { (e.Item.FindControl("lblInfoSueldos") as Label).Text = "No"; } (e.Item.FindControl("lblPeriodo") as Label).Text = string.Format("{0:MM/yyyy}", _periodoActual); (e.Item.FindControl("lblContrato") as Label).Text = _CodigoContrato; if (contE.FechaTramiteBaja.HasValue) { e.Item.Style.Add(HtmlTextWriterStyle.Color, "Red"); e.Item.ToolTip = "Fecha Baja: " + contE.FechaTramiteBaja.Value.ToShortDateString(); } //foreach (DatosDeSueldos sueldo in contE.Legajos.DatosDeSueldos) //{ // if (_periodoActual.Date == sueldo.Periodo.Value.Date) // { // (e.Item.FindControl("lblInfoSueldos") as Label).Text = "Si"; // string strToolTip = ""; // (e.Item.FindControl("lblInfoSueldos") as Label).ToolTip = strToolTip; // return; // } //} //(e.Item.FindControl("lblInfoSueldos") as Label).Text = "No"; } }
protected void RadGridErrorList_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem item) { if (item != null) { // Change cell background to reflect state TableCell cellState = item["Status"]; if (cellState != null) { int n = Utils.StringToInt(cellState.Text.Trim()); string s = cellState.Text.Trim(); if ((n % 10) == 0) { cellState.BackColor = System.Drawing.Color.LightGreen; cellState.Text = "Success"; } else if (Constants.ErrorEvents.Contains(n)) { cellState.BackColor = System.Drawing.Color.Red; cellState.ForeColor = System.Drawing.Color.White; cellState.Text = "Error"; } else if (Constants.WarningEvents.Contains(n)) { cellState.BackColor = System.Drawing.Color.LightYellow; cellState.Text = "Warning"; } else // 0 { cellState.Text = ""; } } } } }