/// <summary> /// Add item to selected list. /// </summary> /// <param name="item">The item to be added.</param> void AddSelectedItem(AutoCompleteItem item) { // Reset text field value. TextInputValue = ""; // Hide the list. isShown = false; // Empty the list if MultiSelect is disabled. if (!MultiSelect) { SelectedItems.Clear(); } // Add the item if its not exists. if (SelectedItems.Find((it) => it.Key == item.Key) == null) { SelectedItems.Add(item); } }
protected void rpterProductList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Header) { LinkButton orderArrow; switch (param.SortColumn) { case "P.Description": orderArrow = (LinkButton)e.Item.FindControl("lnkDescription"); break; case "PP.Price": orderArrow = (LinkButton)e.Item.FindControl("lnkPrice"); break; case "LPPA.Price": orderArrow = (LinkButton)e.Item.FindControl("lnkLastPrice"); break; case "LPPA.PCR": orderArrow = (LinkButton)e.Item.FindControl("lnkPCR"); break; default: orderArrow = (LinkButton)e.Item.FindControl("lnk" + param.SortColumn); break; } if (param.SortOrder == "asc") { orderArrow.CssClass = "up"; } else { orderArrow.CssClass = "down"; } return; } if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } ProductListView prodlisttemp = (ProductListView)e.Item.DataItem; string currency = ViewState["Currency"].ToString(); ((Label)e.Item.FindControl("lblBaseCurrency")).Text = currency + " "; CheckBox chktemp = (CheckBox)e.Item.FindControl("chbSelected"); if (!Marked) { if (!string.IsNullOrEmpty(SelectedItems.Find(delegate(string record) { if (record == prodlisttemp.ID.ToString()) { return(true); } return(false); }))) { chktemp.Checked = true; } else { chktemp.Checked = false; } } else if (Marked) { if (!string.IsNullOrEmpty(SelectedItems.Find(delegate(string record) { if (record == prodlisttemp.ID.ToString()) { return(true); } return(false); }))) { chktemp.Checked = false; } else { chktemp.Checked = true; } } ProductListView plvtemp = (ProductListView)e.Item.DataItem; HtmlTableCell temp = (HtmlTableCell)e.Item.FindControl("tdPrice"); if (plvtemp.LastPrice > plvtemp.Price) { temp.Attributes["class"] = "down"; } else if ((plvtemp.LastPrice > 0) && (plvtemp.LastPrice < plvtemp.Price)) { temp.Attributes["class"] = "up"; } if (plvtemp.LastPrice > 0) { temp.Attributes["title"] = plvtemp.PriceCurrency.ToString() + " " + plvtemp.LastPrice.ToString("#,##0.00"); } Label lbltemp = (Label)e.Item.FindControl("lblPrice"); if (prodlisttemp.PriceSell > prodlisttemp.PriceSuggest) { lbltemp.ForeColor = System.Drawing.Color.Green; } else if ((prodlisttemp.PriceSell < prodlisttemp.PriceSuggest) && (prodlisttemp.PriceSell > prodlisttemp.PricePurchase)) { lbltemp.ForeColor = System.Drawing.Color.Black; } else if (prodlisttemp.PriceSell < prodlisttemp.PricePurchase) { lbltemp.ForeColor = System.Drawing.Color.Red; } HtmlTableCell temptype = (HtmlTableCell)e.Item.FindControl("tdType"); if (plvtemp.Type == ProductType.Hz50) { temptype.Attributes["class"] = "hz50"; } else if (plvtemp.Type == ProductType.Hz60) { temptype.Attributes["class"] = "hz60"; } }