void lstMyStock_ItemDataBound(object sender, ListViewItemEventArgs e) { int mIndex = Convert.ToInt32(e.Item.ID.Replace("ctrl", "")); StockAnalyzer mSA = new StockAnalyzer(); if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem mLvdi = (ListViewDataItem)e.Item; DataRowView mDrv = (DataRowView)mLvdi.DataItem; //ID,Code,Count,BuyPatternCode,BuyPattern,BuyDate,BuyCost,SelPatternCode,SelPattern,SelDate,SelCost string mCode = mDrv["Code"].ToString(); string mBuyDate = mDrv["BuyDate"].ToString(); string mBuyCost = mDrv["BuyCost"].ToString(); string mSelPatternCode = mDrv["SelPatternCode"].ToString(); string mSelPattern = mDrv["SelPattern"].ToString(); string mSelDate = mDrv["SelDate"].ToString(); string mSelCost = mDrv["SelCost"].ToString(); string mSelPattern_Cost = mSelPattern.Split('&')[0]; string mSelPattern_Trade = mSelPattern.Split('&')[1]; string[] mCosts = mSelPattern_Cost.Split(','); double mMinCost = 100000000; for (int i = 0; i < mCosts.Length; i++) { if (Convert.ToDouble(mCosts[i]) < mMinCost) { mMinCost = Convert.ToDouble(mCosts[i]); } } string[] mTrades = mSelPattern_Trade.Split(','); double mMinTrade = 100000000; for (int i = 0; i < mTrades.Length; i++) { string mtest = mTrades[i]; if (Convert.ToDouble(mTrades[i]) < mMinTrade) { mMinTrade = Convert.ToDouble(mTrades[i]); } } if (Convert.ToInt32(mBuyCost) < Convert.ToInt32(mSelCost)) { mSelCost = "<span style='color:#ff0000'>" + mSelCost + "</span>"; } else { mSelCost = "<span style='color:#3366ff'>" + mSelCost + "</span>"; } ((Literal)e.Item.FindControl("litDetailComment")).Text = mDrv["Code"].ToString() + "(매도패턴코드 : " + mSelPatternCode + ", 매수가 : " + mBuyCost + ", 매도가 : " + mSelCost + ")"; ((Literal)e.Item.FindControl("litChart")).Text = GetChartScript(mIndex.ToString(), mSelPattern_Cost, mSelPattern_Trade, (mMinCost - 1), (mMinTrade - 1)); } mSA = null; }
protected void DL_newslist_ItemDatabound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem ditem = (ListViewDataItem)e.Item; //data reader System.Data.DataRowView item = (System.Data.DataRowView)ditem.DataItem; HyperLink NewsTitle = (HyperLink)ditem.FindControl("NewsTitle"); Literal NewsDate = (Literal)ditem.FindControl("NewsDate"); XmlDocument XMLDoc = new XmlDocument(); XMLDoc.LoadXml(item["content_html"].ToString()); string HeadLine = commonfunctions.getFieldValue(XMLDoc, "Headline", "/News"); string Date = commonfunctions.getFieldValue(XMLDoc, "Date", "/News"); string Teaser = commonfunctions.getFieldValue(XMLDoc, "Teaser", "/News"); DateTime DateShown = Convert.ToDateTime(Date); long newsId = long.Parse(item["content_id"].ToString()); NewsDate.Text = DateShown.ToString("MMMM dd, yyyy"); NewsTitle.Text = HeadLine; NewsTitle.NavigateUrl = commonfunctions.getQuickLink(newsId); ; } }
protected void lvUserRole_ItemDataBound(object sender, ListViewItemEventArgs e) { //当前行 var itm = e.Item; //显示值 if (itm.ItemType == ListViewItemType.DataItem) { //全部DropDownList var ddlUser = (DropDownList)itm.FindControl("ddlUser"); var ddlProc = (DropDownList)itm.FindControl("ddlProc"); var ddlRole = (DropDownList)itm.FindControl("ddlRole"); //当前数据行 var row = (DataSetUserRole.t_user_proc_roleRow)((DataRowView)itm.DataItem).Row; if (row != null) { //取得当前项 var itemUser = ddlUser.Items.FindByValue(row.u_id.ToString()); var itemProc = ddlProc.Items.FindByValue(row.proc_id.ToString()); var itemRole = ddlRole.Items.FindByValue(row.ro_id.ToString()); //设置值 if (itemUser != null && itemProc != null && itemRole != null) { itemUser.Selected = true; itemProc.Selected = true; itemRole.Selected = true; } } } }
protected void MemberSectionList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var module = dataItem.DataItem as MembershipStaticPageItem; if (module != null) { string EnqFormUrl; if (module.Offer.Item != null) { //Get offer OfferItem offer = (OfferItem)module.Offer.Item; EnqFormUrl = enqForm.Url + "?sc_trk=enq&page=" + offer.GetOfferTypeValue() + "&offerId=" + offer.OfferId.Raw + "&clubId=" + currentClub.ClubId.Raw; } else { EnqFormUrl = enqForm.Url + "?sc_trk=enq&c=" + currentClub.InnerItem.ID.ToShortID().ToString(); } module.FormUrl = EnqFormUrl; Literal ltrFormLink = (Literal)e.Item.FindControl("ltrFormLink"); ltrFormLink.Text = "<a href=\"" + EnqFormUrl + "\" class=\"btn btn-cta-big gaqTag\" data-gaqcategory=\"CTA\" data-gaqaction=\"EnquireNow\" data-gaqlabel=\"Membership\">" + Translate.Text("Enquire now") + "</a>"; } } }
protected void WidgetList_OnItemDataBound(object sender, ListViewItemEventArgs e) { //if (e.Item.ItemType == ListViewItemType.DataItem) //{ // ListViewDataItem dataItem = (ListViewDataItem)e.Item; // var widgetItem = dataItem.DataItem as LinkWidgetItem; // if (widgetItem != null) // { // //Get link url // var linkUrl = e.Item.FindControl("linkUrl") as System.Web.UI.WebControls.Literal; // if (linkUrl != null) // { // if (isClubSection) // { // //get clubID // ClubItem club = new ClubItem(Sitecore.Context.Item.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId))); // //append club id to url // if (club != null) // { // linkUrl.Text = widgetItem.Widget.Buttonlink.Url.IndexOf("?") == -1 ? widgetItem.Widget.Buttonlink.Url + "&c=" + club.ID.ToString() : widgetItem.Widget.Buttonlink.Url + "?c=" + club.ID.ToString(); // } // } // else // { // linkUrl.Text = widgetItem.Widget.Buttonlink.Url; // } // } // } //} }
protected void CategoriesList1_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { List<CategoriesDL> dt = (List<CategoriesDL>)CategoriesList1.DataSource; CategoriesDL row = dt[recindex1]; HyperLink clink = (HyperLink)e.Item.FindControl("CatLink"); if (cityID > 0 && areaID > 0) { clink.NavigateUrl = String.Concat(basedomain, "/blog/", row.CatUrlName, "/", CityDL.GetCityUrlByID(cityID), "/", AreaDL.GetAreaUrlByID(areaID)); } else { clink.NavigateUrl = String.Concat(basedomain, "/blog/", row.CatUrlName); } clink.Text = row.Name; if ((row.Id != Convert.ToInt32(catid)) && catid != "0") { clink.Attributes.Add("rel", "nofollow"); } if (row.Id == Convert.ToInt32(catid)) { clink.CssClass += " selected"; } recindex1++; } }
protected void ClubListUK_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; var club = dataItem.DataItem as ClubItem; var lnkClub = e.Item.FindControl("lnkClub") as System.Web.UI.WebControls.Literal; string ClubLinkUrl = "http://www.virginactive.co.uk/clubs/" + club.Name; if (lnkClub != null) { if (club.IsFirst) { lnkClub.Text = @"<a href=""" + ClubLinkUrl + @""" class=""external club uk first"">" + club.Clubname.Rendered + @"</a>"; } else { lnkClub.Text = @"<a href=""" + ClubLinkUrl + @""" class=""external club uk"">" + club.Clubname.Rendered + @"</a>"; } } } }
protected void lvFeedbacks_ItemCreated(object sender, ListViewItemEventArgs e) { ImageButton lb = e.Item.FindControl("ibDelete") as ImageButton; lb.Visible = this.IsEditMode; Label l = e.Item.FindControl("lblFeedbackWriterEmail") as Label; l.Visible = this.IsEditMode; }
//protected void ltvThumbnail_itemDataBound(object sender,ListViewItemEventArgs e) //{ // if(e.Item.ItemType==ListViewItemType.DataItem) // { // if (e.Item.ItemType == ListViewItemType.DataItem) // { // EstateAgentAzure estate = (EstateAgentAzure)e.Item.DataItem; // ListViewDataItem item = (ListViewDataItem)e.Item; // HyperLink imagelogo = (HyperLink)item.FindControl("imgLogoEstate"); // if (!string.IsNullOrWhiteSpace(estate.ProfilePhotoUrl) && !estate.ProfilePhotoUrl.Contains("empty_thumbnail.gif")) // { // imagelogo.ImageUrl = estate.ProfilePhotoUrl; // imagelogo.NavigateUrl = "~/Public/AgentDetails.aspx?agentID=" + estate.EstateAgentID + "&UserType=" + estate.UserID; // } // } // } //} protected void lstFeaturedProperty_itemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { PropertyTableAzure table = (PropertyTableAzure)e.Item.DataItem; ListViewDataItem item = (ListViewDataItem)e.Item; HyperLink imageProperty = (HyperLink)item.FindControl("imgFeaturedProperty"); Label lblPropertyTypeArea = (Label)item.FindControl("lblPropertyTypeArea"); Label lblPrice = (Label)item.FindControl("lblPropertyPrice"); Label lblTimeAdded = (Label)item.FindControl("lblTimeAdded"); if (table.ImageUrlAzures != null && table.ImageUrlAzures.Count>0) { var imgUrl = (from url in table.ImageUrlAzures select url).First(); imageProperty.ImageUrl = imgUrl.thumbnailblob; imageProperty.NavigateUrl = "~/Public/PropertyDetails.aspx?PropertyID=" + table.PropertyID; //imageProperty.NavigateUrl = "../Public/SearchResult.aspx?SearchTerm=" + table.Province + "&SearchType=2&City=" + table.City; } lblPrice.Text = "Kshs " + table.PriceTableAzure.MonthlyRental; lblPropertyTypeArea.Text = CheckContainHomeType(table.PriceTableAzure.Attributes) + " " + table.PropertyType + " in " + table.City; sellmetaTag = lblPropertyTypeArea.Text + " at " + "Kshs" + table.PriceTableAzure.MonthlyRental + ","; int hour = (DateTime.Now - table.Added).Hours; lblTimeAdded.Text = "Added " + hour + "hours ago"; } }
protected void DL_SubjectArealist_ItemDatabound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem ditem = (ListViewDataItem)e.Item; //data reader System.Data.DataRowView item = (System.Data.DataRowView)ditem.DataItem; Literal myfavicons = (Literal)ditem.FindControl("myfavicons"); HyperLink SubjectAreaTitle = (HyperLink)ditem.FindControl("SubjectAreaTitle"); Literal Description = (Literal)ditem.FindControl("Description"); XmlDocument XMLDoc = new XmlDocument(); XMLDoc.LoadXml(item["content_html"].ToString()); string ShortDescription = commonfunctions.getFieldValue(XMLDoc, "ShortDescription", "/SubjectAreas"); string Name = commonfunctions.getFieldValue(XMLDoc, "Name", "/SubjectAreas"); long saId = long.Parse(item["content_id"].ToString()); Description.Text = ShortDescription; myfavicons.Text = commonfunctions.getMyFavIcons(saId.ToString(), "2", Title, "0"); SubjectAreaTitle.Text = Name; SubjectAreaTitle.NavigateUrl = commonfunctions.getQuickLink(saId); ; } }
public void BindSelectedPermission(object sender, ListViewItemEventArgs e) { KeyValuePair<string, ModelPermissionLevel> item = (KeyValuePair<string, ModelPermissionLevel>)e.Item.DataItem; string grpName = item.Key; ModelPermissionLevel lvl = item.Value; // To the user, these are equivalent in terms of access if (lvl == ModelPermissionLevel.NotSet) lvl = _permissionsManager.CheckGroupPermissions(_permissionsManager.GetUserGroup(DefaultGroups.AllUsers), _pid); var row = e.Item.FindControl("DataRow"); if (grpName == DefaultGroups.AllUsers) ((System.Web.UI.HtmlControls.HtmlTableCell)row.Controls[0]).InnerText = PermissionsManager.ALL_USERS_LABEL; else if (grpName == DefaultGroups.AnonymousUsers) ((System.Web.UI.HtmlControls.HtmlTableCell)row.Controls[0]).InnerText = PermissionsManager.ANONYMOUS_USERS_LABEL; if (e.Item.ItemType == ListViewItemType.DataItem) { DropDownList dd = (DropDownList)row.FindControl("DropdownColumn") .FindControl("PermissionsDropdownList"); foreach(ListItem li in dd.Items) { if (Int32.Parse(li.Value) == (int)lvl) { li.Selected = true; break; } } } }
protected void lvAuthorList_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType != ListViewItemType.DataItem) return; Author author = e.Item.DataItem as Author; if (author == null) return; HyperLink hlAuthor = e.Item.FindControl("hlAuthor") as HyperLink; if (hlAuthor != null) { string itemID = author.ItemId.ToString(); string countDisplay = ""; if (authorCount.ContainsKey(itemID) && settingsItem.DisplayCountOnTagList) { countDisplay = String.Format(" ({0})", authorCount[itemID].ToString()); } hlAuthor.Text = author.FullName + countDisplay; hlAuthor.NavigateUrl = AuthorManager.GetAuthorViewUrl(author.FullName, settingsItem); Literal litProfileImage = e.Item.FindControl("litProfileImage") as Literal; if (litProfileImage != null && author.ProfileImage != null && author.ProfileImage.MediaItem != null && settingsItem.AuthorListDisplayImage) { litProfileImage.Text = String.Format("<img src=\"{0}?mw={1}\" border=\"0\" />", MediaManager.GetMediaUrl(author.ProfileImage.MediaItem), settingsItem.AuthorListImageMaxWidth); } } }
protected void TransactionsLv_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { Transaction item = (Transaction)e.Item.DataItem; Literal _TransIdLtr = (Literal)e.Item.FindControl("TransIdLtr"); Literal _TransTypeLtr = (Literal)e.Item.FindControl("TransTypeLtr"); Literal _FromAccountLtr = (Literal)e.Item.FindControl("FromAccountLtr"); Literal _ToAccountLtr = (Literal)e.Item.FindControl("ToAccountLtr"); Literal _AmountLtr = (Literal)e.Item.FindControl("AmountLtr"); Literal _CommentLtr = (Literal)e.Item.FindControl("CommentLtr"); Literal _TransDateLtr = (Literal)e.Item.FindControl("TransDateLtr"); _TransIdLtr.Text = item.Id.ToString(); _FromAccountLtr.Text = item.SourceAccountId.ToString(); _ToAccountLtr.Text = item.DestinationAccountNumber.ToString(); _TransDateLtr.Text = item.TransactionDate.Value.ToString("dd/MM/yy"); _TransTypeLtr.Text = item.TransTypeName; if (item.Comment != "" && item.Comment != null) _CommentLtr.Text = item.Comment.Trim(); if (item.TransactionAmount != null) { if (item.Type == (int)Code.Enums.Enums.TransType.Credit) _AmountLtr.Text = string.Format("${0}", Math.Round((decimal)item.TransactionAmount, 2)); else _AmountLtr.Text = string.Format("-${0}", Math.Round((decimal)item.TransactionAmount, 2)); } else _AmountLtr.Text = "$0.00"; } }
protected void lvLinks_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { var item = e.Item.DataItem as Item; var phLink = e.Item.FindControl("phLink") as PlaceHolder; switch(item.TemplateID.ToString()) { case Constants.TemplateIDs.ApplicationShortcut: var lnkItem = new HyperLink(); lnkItem.Text = StringUtil.GetString(item.Fields[Constants.FieldIDs.ApplicationShortcutDisplayName].Value, item.DisplayName); lnkItem.Attributes["href"] = "#"; lnkItem.Attributes["onclick"] = string.Format("javascript:scForm.postRequest('', '', '', 'appshortcut:open(appid={0})'); return false;", item.ID); phLink.Controls.Add(lnkItem); break; case Constants.TemplateIDs.Link: var link = new Sitecore.Web.UI.WebControls.Link() { Item = item, Field = Constants.FieldIDs.LinkLink }; if (string.IsNullOrEmpty(link.Text)) { link.Text = item.DisplayName; } phLink.Controls.Add(link); break; } } }
protected void lstTask_DataBound(object sender, ListViewItemEventArgs e) { Button btnClaim; Label lblHeat, lblDocs, lblOther; Dictionary<string, string> cred = getCredentials(Session["secureuser"].ToString()); //Show the claim task button only if the current task is assigned to current users section if (e.Item.ItemType == ListViewItemType.DataItem) { System.Data.DataRowView rowView = e.Item.DataItem as System.Data.DataRowView; btnClaim = (Button)e.Item.FindControl("btnClaim"); lblHeat = (Label)e.Item.FindControl("lblHeat"); lblDocs = (Label)e.Item.FindControl("lblDocs"); lblOther = (Label)e.Item.FindControl("lblOther"); string SectionID = rowView["Section_ID"].ToString(); string EmployeeID = rowView["Employee_ID"].ToString(); string HeatID = rowView["Heat_ID"].ToString(); string Docs = rowView["Documentation"].ToString(); string Other = rowView["Other_Resources"].ToString(); string currentUsersSection = cred["sec_id"].ToString(); if (btnClaim != null) { if (currentUsersSection == SectionID & EmployeeID == "") { btnClaim.Visible = true; } } if (HeatID == "" || HeatID == null) { lblHeat.Visible = false; } if (Docs == "" || Docs == null) { lblDocs.Visible = false; } if (Other == "" || Other == null) { lblOther.Visible = false; } } }
void lstLog_ItemDataBound(object sender, ListViewItemEventArgs e) { int mIndex = Convert.ToInt32(e.Item.ID.Replace("ctrl", "")); StockAnalyzer mSA = new StockAnalyzer(); if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem mLvdi = (ListViewDataItem)e.Item; DataRowView mDrv = (DataRowView)mLvdi.DataItem; //Code,Type,Count,Cost,RegDate string mCode = mDrv["Code"].ToString(); string mType = mDrv["Type"].ToString(); string mCost = mDrv["Cost"].ToString(); string mCount = mDrv["Count"].ToString(); string mRegDate = mDrv["RegDate"].ToString(); ((Literal)e.Item.FindControl("litDate")).Text = mRegDate; ((Literal)e.Item.FindControl("litComment")).Text = "Type:" + mType + " 금액:" + (Convert.ToInt32(mCost) * Convert.ToInt32(mCount)) + " 코드:" + mCode; } mSA = null; }
protected void DallasAreaList_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { SqlDataReader rdr = (SqlDataReader)DallasAreaList.DataSource; HyperLink area = (HyperLink)e.Item.FindControl("DallasAreaLink"); string areaname = rdr["AreaUrlName"].ToString(); string arealabel = rdr["AreaName"].ToString(); switch (areaname) { case "southlake-grapevine-colleyville": arealabel = "Southlake/Grapevine/Colleyville"; break; case "flower-mound-lewisville-highland-village": arealabel = "Flower Mound/Lewisville/Highland Village"; break; case "plano-frisco-allen-mckinney": arealabel = "Plano/Frisco/Allen/McKinney"; break; } area.Text = arealabel; area.NavigateUrl = basedomain + "/" + dalcat + "/" + rdr["CityUrlName"].ToString() + "/" + rdr["AreaUrlName"].ToString(); } }
protected void DetailsListView_ItemDataBound(object sender, ListViewItemEventArgs e) { //Get the item object. ListViewDataItem dataItem = (ListViewDataItem)e.Item; if (e.Item.ItemType == ListViewItemType.DataItem) { // Retrieve the underlying data item. In this example // the underlying data item is a DataRowView object. DataRowView rowView = (DataRowView)dataItem.DataItem; // Retrive and Assign Product details to Shopping Cart name = rowView["prod_title"].ToString(); sPrice = rowView["O_price"].ToString(); price = decimal.Parse(sPrice); itemPic = rowView["prod_img1"].ToString(); type = rowView["category"].ToString(); quantity = 1; total = quantity * price; _smPrice = rowView["M_Price"].ToString(); mPrice = decimal.Parse(_smPrice) * quantity; days = rowView["days_delivered"].ToString(); dayDelivered = Convert.ToInt32(days); sDiscount = rowView["discount_percent"].ToString(); discount = decimal.Parse(sDiscount); prod_id = rowView["prod_Id"].ToString(); } }
protected void PostList_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { var postUrl = "/blog/post/" + listTable[recordNumber].UrlTitle; if (listTable[recordNumber].ImagePath != "" && bool.Parse(listTable[recordNumber].ImageSummary)) { Image img = (Image)e.Item.FindControl("PostImage"); img.ImageUrl = "/blogfiles/assets/media/" + listTable[recordNumber].ImagePath; img.Visible = true; var imgLink = (HyperLink)e.Item.FindControl("PostImageLink"); imgLink.NavigateUrl = postUrl; } HyperLink title = (HyperLink)e.Item.FindControl("PostTitle"); title.Text = listTable[recordNumber].Title; title.NavigateUrl = postUrl; HyperLink more = (HyperLink)e.Item.FindControl("ReadMoreLink"); more.NavigateUrl = postUrl; Label PostMonth = (Label)e.Item.FindControl("PostDateMonth"); PostMonth.Text = FormatDate(listTable[recordNumber].PublishDate); Label PostDate = (Label)e.Item.FindControl("PostDate"); PostDate.Text = DateTime.Parse(listTable[recordNumber].PublishDate).Day.ToString(); recordNumber++; } }
protected void ListViewRepairSheet_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem DataItem = (ListViewDataItem)e.Item; DataRowView dv = (DataRowView)DataItem.DataItem; AfterSaleServiceSystem.DAL.dsRepairSheet.tb_repairsheetRow repairsheetRow = (AfterSaleServiceSystem.DAL.dsRepairSheet.tb_repairsheetRow)dv.Row; tb_repairstateTableAdapter repairstateTableAdapter = new tb_repairstateTableAdapter(); if (repairstateTableAdapter.GetDatabyid(repairsheetRow.repairstateid).Rows.Count > 0) { AfterSaleServiceSystem.DAL.dsRepairState.tb_repairstateRow repairstateRow = (AfterSaleServiceSystem.DAL.dsRepairState.tb_repairstateRow) repairstateTableAdapter.GetDatabyid(repairsheetRow.repairstateid).Rows[0]; Label lb = (Label)e.Item.FindControl("repairstateidLabel"); if (lb != null) lb.Text = repairstateRow.description; } tb_customTableAdapter customTableAdapter = new tb_customTableAdapter(); if (customTableAdapter.GetDataByid(repairsheetRow.customid).Rows.Count > 0) { AfterSaleServiceSystem.DAL.dsCustomer.tb_customRow customRow = (AfterSaleServiceSystem.DAL.dsCustomer.tb_customRow) customTableAdapter.GetDataByid(repairsheetRow.customid).Rows[0]; Label lb = (Label)e.Item.FindControl("customidLabel"); if (lb != null) lb.Text = customRow.company; } } }
protected void lbAlbums_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { Folder data = ((ListViewDataItem)e.Item).DataItem as Folder; HyperLink lnkImage = e.Item.FindControl("lnkImage") as HyperLink; lnkImage.NavigateUrl = "~/Photos/ViewAlbum.aspx?AlbumID=" + data.FolderID; Image image = e.Item.FindControl("Image") as Image; image.ImageUrl = "~/Files/Photos/" + data.FullPathToCoverImage; image.AlternateText = data.Name; HyperLink lnkEdit = e.Item.FindControl("lnkEdit") as HyperLink; lnkEdit.NavigateUrl = "~/Photos/EditAlbum.aspx?AlbumID=" + data.FolderID; LinkButton linkDeleteAlbum = e.Item.FindControl("linkDeleteAlbum") as LinkButton; linkDeleteAlbum.Attributes.Add("OnClick", "javascript:return(confirm('Bạn có chắc chắn muốn xóa album này?'));"); linkDeleteAlbum.Attributes.Add("FolderID", data.FolderID.ToString()); HyperLink lnkView = e.Item.FindControl("lnkView") as HyperLink; lnkView.NavigateUrl = "~/Photos/ViewAlbum.aspx?AlbumID=" + data.FolderID; lnkView.Text = data.Name; } }
protected void lvSummary_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; RouteOrder r = (RouteOrder)(dataItem.DataItem); Label lblRouteTotal = (Label)(dataItem.FindControl("lblRouteTotal")); lblRouteTotal.Text = r.RouteTotalAmount.ToString("c") + " USD"; Label lblRouteName = (Label)(dataItem.FindControl("lblRouteName")); Route route = new Route().GetRouteBySchedule(r.ScheduleId.Value); lblRouteName.Text = route.DeparturePort.PortName + " - " + route.ArriavlPort.PortName; Schedule schedule = new Schedule().GetById(r.ScheduleId.Value, false); Label lblVesselName = (Label)(dataItem.FindControl("lblVesselName")); lblVesselName.Text = schedule.Vessel.VesselName; Vessel vessel = new Vessel().GetById(schedule.VesselId.Value, false); Label lblCompanyName = (Label)(dataItem.FindControl("lblCompanyName")); lblCompanyName.Text = vessel.Operator.CompanyName; Label lblDepartureDatetime = (Label)(dataItem.FindControl("lblDepartureDatetime")); lblDepartureDatetime.Text = schedule.SailingTime.HasValue ? schedule.SailingTime.Value.ToString() : string.Empty; Label lblArrivalDatetime = (Label)(dataItem.FindControl("lblArrivalDatetime")); lblArrivalDatetime.Text = schedule.ArrivalTime.HasValue ? schedule.ArrivalTime.Value.ToString() : string.Empty; Label lblPassenger = (Label)(dataItem.FindControl("lblPassenger")); Label lblTransport = (Label)(dataItem.FindControl("lblTransport")); Label lblAccommodation = (Label)(dataItem.FindControl("lblAccommodation")); } }
protected void lvGreenhouses_ItemDataBound(object sender, ListViewItemEventArgs e) { var litGreenhouseId = e.Item.FindControl("litGreenhouseId") as Literal; var linkView = e.Item.FindControl("linkView") as HyperLink; if (linkView != null && litGreenhouseId != null) linkView.NavigateUrl = string.Format("~/Greenhouses/ViewGreenhouse.aspx?GreenhouseID={0}", litGreenhouseId.Text); }
// checks weather an item is on sale protected void CheckSale(object source, ListViewItemEventArgs e) { ListViewDataItem item = (ListViewDataItem)e.Item; // Get the index of the listviewitem in the underlying data source object. int myDataItemIndex = item.DataItemIndex; Label sale = (Label)e.Item.FindControl("lblOnSale"); Label saleAnswer = (Label)e.Item.FindControl("lblOnSaleAnswer"); Label price = (Label)e.Item.FindControl("lblPriceAnswer"); //for (int i = 0; i < myDataItemIndex; i++ ) //{ if (saleAnswer.Text == "") { sale.Visible = false; saleAnswer.Visible = false; } else { // sale.Text = "On Sale: "; price.ForeColor = Color.Red; price.Visible = true; price.Font.Bold = true; price.Font.Strikeout = true; saleAnswer.ForeColor = Color.DarkBlue; saleAnswer.Font.Bold = true; } //} }
protected void lvEducation_ItemDataBound(object sender, ListViewItemEventArgs e) { TextBox txtInstitutionName = (TextBox)e.Item.FindControl("txtInstitutionName") as TextBox; TextBox txtDegreeTitle = (TextBox)e.Item.FindControl("txtDegreeTitle") as TextBox; DropDownList DDCategory = (DropDownList)e.Item.FindControl("DDCategory") as DropDownList; TextBox txtBatch = (TextBox)e.Item.FindControl("txtBatch") as TextBox; Literal litInstitutionName = (Literal)e.Item.FindControl("litInstitutionName") as Literal; Literal litDegreeTitle = (Literal)e.Item.FindControl("litDegreeTitle") as Literal; Literal litBatch = (Literal)e.Item.FindControl("litBatch") as Literal; Literal litCategory = (Literal)e.Item.FindControl("litCategory") as Literal; Literal litPK = (Literal)e.Item.FindControl("litPK") as Literal; txtInstitutionName.Text = litInstitutionName.Text; txtDegreeTitle.Text = litDegreeTitle.Text; DDCategory.Text = litCategory.Text; txtBatch.Text = litBatch.Text; LinkButton lnkRemove = (LinkButton)e.Item.FindControl("lnkRemove") as LinkButton; lnkRemove.Attributes.Add("InstitutionName", litInstitutionName.Text); lnkRemove.Attributes.Add("DegreeTitle", litDegreeTitle.Text); lnkRemove.Attributes.Add("Category", litCategory.Text); lnkRemove.Attributes.Add("Batch", litBatch.Text); }
void lstSellPatternList_ItemDataBound(object sender, ListViewItemEventArgs e) { int mIndex = Convert.ToInt32(e.Item.ID.Replace("ctrl", "")); if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem mLvdi = (ListViewDataItem)e.Item; DataRowView mDrv = (DataRowView)mLvdi.DataItem; //SelPatternCode, (SUM(SelCost) - SUM(BuyCost)) as Revenue string mSelPatternCode = mDrv["SelPatternCode"].ToString(); string mRevenue = mDrv["Revenue"].ToString(); if (Convert.ToInt32(mRevenue) < 0) { mRevenue = "<span style='color:#ff0000'>" + mRevenue + "</span>"; } else { mRevenue = "<span style='color:#3366ff'>" + mRevenue + "</span>"; } ((Literal)e.Item.FindControl("litSellPattern")).Text = mSelPatternCode; ((Literal)e.Item.FindControl("litValue")).Text = mRevenue; } }
protected void lstProperty_itemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { PropertyTableAzure property = (PropertyTableAzure)e.Item.DataItem; HtmlImage link = (HtmlImage)e.Item.FindControl("imgProperty"); HtmlAnchor html = (HtmlAnchor)e.Item.FindControl("hyparchor"); Label price = (Label)e.Item.FindControl("lblPrice"); Label street = (Label)e.Item.FindControl("lblStreet"); Label suburb = (Label)e.Item.FindControl("lblSuburb"); Label city = (Label)e.Item.FindControl("lblCity"); if (property.ImageUrlAzures.Any()) { html.HRef = Settings.Default.PropertyUrlSA + "Public/PropertyDetails.aspx?PropertyID=" + property.PropertyID; link.Src = property.ImageUrlAzures[0].thumbnailblob; //link.Target = "_blank"; //link.NavigateUrl = Settings.Default.PropertyUrlKA + "Public/PropertyDetails.aspx?PropertyID=" + property.PropertyID; } price.Text = property.Price; street.Text = property.StreetName; suburb.Text = property.Suburb; city.Text = property.City; } }
void lvExperts_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ExpertDetailPageItem expert = (ExpertDetailPageItem)e.Item.DataItem; FieldRenderer frExpertName = (FieldRenderer)e.Item.FindControl("frExpertName"); FieldRenderer frExpertSubheading = (FieldRenderer)e.Item.FindControl("frExpertSubheading"); FieldRenderer frTwitterLink = (FieldRenderer)e.Item.FindControl("frTwitterLink"); FieldRenderer frBlogLink = (FieldRenderer)e.Item.FindControl("frBlogLink"); frExpertName.Item = frExpertSubheading.Item = frTwitterLink.Item = frBlogLink.Item = expert; System.Web.UI.WebControls.Image imgExpert = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgExpert"); imgExpert.ImageUrl = expert.GetThumbnailUrl(230, 230); HyperLink hlExpertDetail = (HyperLink)e.Item.FindControl("hlExpertDetail"); HyperLink hlExpertName = (HyperLink)e.Item.FindControl("hlExpertName"); HyperLink hlExpertThumbnail = (HyperLink)e.Item.FindControl("hlExpertThumbnail"); hlExpertDetail.NavigateUrl = hlExpertName.NavigateUrl = hlExpertThumbnail.NavigateUrl = expert.GetUrl(); Repeater rptTasks = (Repeater)e.Item.FindControl("rptTasks"); var tasks = expert.GetTasks(); if (tasks.Any()) { rptTasks.DataSource = tasks; rptTasks.DataBind(); } } }
protected void lvAlbum_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { File data = ((ListViewDataItem)e.Item).DataItem as File; HyperLink lnkView = e.Item.FindControl("lnkView") as HyperLink; HyperLink lnkImage = e.Item.FindControl("lnkImage") as HyperLink; string pathToImage = "~/files/photos/" + lnkImage.NavigateUrl + "/" + data.FileSystemName; lnkImage.NavigateUrl = "~/Photos/ViewView.aspx?FileID=" + data.FileID; lnkView.NavigateUrl = "~/Photos/ViewView.aspx?FileID=" + data.FileID; string name = data.FileName; if (name.Length > 25) name = name.Substring(0, 25); lnkView.Text = System.IO.Path.GetFileNameWithoutExtension(name); lnkView.NavigateUrl = "~/Photos/ViewView.aspx?FileID=" + data.FileID; Image image = e.Item.FindControl("Image") as Image; image.ImageUrl = pathToImage + "__s." + data.Extension; image.AlternateText = data.FileName; } else if (e.Item.ItemType == ListViewItemType.EmptyItem) { HyperLink linkAddPhotos = e.Item.FindControl("linkAddPhotos") as HyperLink; linkAddPhotos.NavigateUrl = "~/photos/AddPhotos.aspx?AlbumID=" + _webContext.AlbumID.ToString(); } }
protected void lvCart_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { var dataItem = e.Item as ListViewDataItem; if (dataItem != null) { var sci = dataItem.DataItem as ShoppingCartItem; if (sci != null) { var hlProduct = dataItem.FindControl("hlProduct") as HyperLink; if (hlProduct != null) { hlProduct.NavigateUrl = SEOHelper.GetProductUrl(sci.ProductVariant.Product); hlProduct.Text = Server.HtmlEncode(sci.ProductVariant.LocalizedFullProductName); } var lblQty = dataItem.FindControl("lblQty") as Label; if (lblQty != null) { lblQty.Text = string.Format("{0} x ", sci.Quantity); } } } } }
protected void Unnamed_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { var btn = e.Item.Controls[1] as Button; bool isChecked = (e.Item.DataItem as SkillViewModel).Checked; btn.Text = isChecked ? "Remove" : "Add"; btn.CssClass = "btn " + (isChecked ? "btn-info" : "btn-danger"); }
protected void lvVersions_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { HtmlTextInfo htmlText = (HtmlTextInfo)e.Item.DataItem; Literal litVersion = (Literal)e.Item.FindControl("litVersion"); Literal litDate = (Literal)e.Item.FindControl("litDate"); Literal litTitle = (Literal)e.Item.FindControl("litTitle"); Literal litContent = (Literal)e.Item.FindControl("litContent"); Literal litDisplayName = (Literal)e.Item.FindControl("litDisplayName"); Literal litPublished = (Literal)e.Item.FindControl("litPublished"); ImageButton btnRemove = (ImageButton)e.Item.FindControl("btnRemove"); ImageButton btnPreview = (ImageButton)e.Item.FindControl("btnPreview"); ImageButton btnRollback = (ImageButton)e.Item.FindControl("btnRollback"); litVersion.Text = htmlText.Version.ToString(); DateTime lastModifiedDate = htmlText.LastModifiedOnDate > htmlText.CreatedOnDate ? htmlText.LastModifiedOnDate : htmlText.CreatedOnDate; litDate.Text = lastModifiedDate.ToString("dd/MM/yyyy hh:mm:ss"); litTitle.Text = htmlText.ModuleTitle; litContent.Text = HtmlUtils.Shorten(HtmlUtils.Clean(htmlText.Content, false), 80, "..."); int lastModifiedBy = htmlText.LastModifiedOnDate > htmlText.CreatedOnDate ? htmlText.LastModifiedByUserId : htmlText.CreatedByUserID; var objUser = DotNetNuke.Entities.Users.UserController.GetUserById(PortalId, lastModifiedBy); litDisplayName.Text = objUser != null ? objUser.DisplayName : "Default"; litPublished.Text = htmlText.IsPublished.ToString(); //set command args btnRemove.CommandArgument = htmlText.ItemId.ToString(); btnPreview.CommandArgument = htmlText.ItemId.ToString(); btnRollback.CommandArgument = htmlText.ItemId.ToString(); //hide remove button for Non-Admin string deleteMsg = Localization.GetString("DeleteVersion.Confirm", LocalResourceFile) .Replace("[VERSION]", htmlText.Version.ToString()) .Replace("[LOCALE]", htmlText.Locale); btnRemove.OnClientClick = "return confirm(\"" + deleteMsg + "\");"; btnRemove.Visible = (UserInfo.IsSuperUser || PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName)); //hide rollback button for current active item if (_topHtmlTextItemId == -1) { var item = _htmlTextController.GetTopHtmlText(ModuleId, ddlLocale.SelectedValue, true); if (item != null) { _topHtmlTextItemId = item.ItemId; } } string rollbackMsg = Localization.GetString("RollbackVersion.Confirm", LocalResourceFile) .Replace("[VERSION]", htmlText.Version.ToString()) .Replace("[LOCALE]", htmlText.Locale); btnRollback.OnClientClick = "return confirm(\"" + rollbackMsg + "\");"; btnRollback.Visible = (htmlText.ItemId != _topHtmlTextItemId); } }
protected void RecentEditsList_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { if (e.Item.DataItem == null) { return; } var dataItem = (IMediaDetail)e.Item.DataItem; var HyperLink = (HtmlAnchor)e.Item.FindControl("HyperLink"); HyperLink.HRef = GetAdminUrl(dataItem.MediaTypeID, dataItem.MediaID); }
protected void ListView1_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { if (e.Item.ItemType == System.Web.UI.WebControls.ListViewItemType.DataItem) { Button btn = (Button)e.Item.FindControl("DeleteItemButton"); HtmlGenericControl lbl = (HtmlGenericControl)e.Item.FindControl("submitByLabel"); //if user does not signin, delete button is invisible btn.Visible = Request.IsAuthenticated; //recipe can only deleted by the submitted user or role adiministrators btn.Enabled = User.IsInRole("Administrators") || lbl.InnerText == User.Identity.Name; } }
protected void MediaFieldsList_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { if (e.Item.DataItem == null) { return; } var mediaDetailField = (MediaDetailField)e.Item.DataItem; var FieldID = (HiddenField)e.Item.FindControl("FieldID"); var FieldLabel = (Literal)e.Item.FindControl("FieldLabel"); var DynamicField = (PlaceHolder)e.Item.FindControl("DynamicField"); var FieldWrapper = (Panel)e.Item.FindControl("FieldWrapper"); FieldID.Value = mediaDetailField.ID.ToString(); FieldWrapper.CssClass += " " + mediaDetailField.FieldCode; //FieldLabel.Text = mediaDetailField.FieldLabel; //var propertyName = mediaDetailField.GetValueCode; Control dynamicField = null; Control control = null; string code = ""; try { dynamicField = this.ParseControl(MediaDetailsMapper.ParseSpecialTags(SelectedItem, mediaDetailField.AdminControl, 0, new RazorFieldParams() { MediaDetail = SelectedItem, Field = mediaDetailField })); } catch (Exception ex) { BasePage.DisplayErrorMessage("Error Creating Field with ID: " + FieldID.Value, ErrorHelper.CreateError(ex)); //ErrorHelper.LogException(ex); } finally { if (dynamicField != null) { DynamicField.Controls.Add(dynamicField); } } }
protected void lstArticles_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { HiddenField hdnArticleId = (HiddenField)e.Item.FindControl("hdnArticleId"); HtmlGenericControl spnLike = e.Item.FindControl("spnLike") as HtmlGenericControl; objDOSAJor.ArticleID = Convert.ToInt32(hdnArticleId.Value); objDOSAJor.JournalID = Convert.ToInt32(Request.QueryString["JrnlId"]); objDOSAJor.IntUserId = Convert.ToInt32(Session["ExternalUserId"]); DataTable artLikes = objDASAJor.GetDataTable(objDOSAJor, DA_SAJournal.Case.GetLikeUnlike); if (artLikes.Rows.Count > 0) { spnLike.Attributes["class"] = "active-toogle on-flag"; } else { spnLike.Attributes["class"] = "active-toogle"; } }
protected void lstComments_ItemDataBound(object sender, System.Web.UI.WebControls.ListViewItemEventArgs e) { DataRowView drv = e.Item.DataItem as DataRowView; HtmlGenericControl lnkmani = e.Item.FindControl("lnkmani") as HtmlGenericControl; HtmlImage imgUser = (HtmlImage)e.Item.FindControl("imgUser"); string imgPathPhysical = Server.MapPath("~/CroppedPhoto/" + drv["PhotoPath"]); if (File.Exists(imgPathPhysical)) { imgUser.Src = "~\\CroppedPhoto\\" + drv["PhotoPath"].ToString(); ViewState["imgComment"] = "~\\CroppedPhoto\\" + drv["PhotoPath"].ToString(); } else { imgUser.Src = "images/profile-photo.png"; } if (drv["AddedByID"].ToString() == Session["ExternalUserId"].ToString()) { lnkmani.Style.Add("display", "block"); } }