protected void getLinkedData(Object Sender, RepeaterItemEventArgs e) { HtmlContainerControl ORDetailsLink = (HtmlContainerControl)e.Item.FindControl("ORDetailsLink"); if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int ORDetailId = 0; if (((DataRowView)e.Item.DataItem)[BOL.Procedure.OperatingRoomDetailId].ToString() != null && int.TryParse(((DataRowView)e.Item.DataItem)[BOL.Procedure.OperatingRoomDetailId].ToString(), out ORDetailId)) { ORDetailsLink.Visible = true; } else { ORDetailsLink.Visible = false; } PathologyDa paDa = new PathologyDa(); DataSet paDs = paDa.FormGetRecords(this._patientId, this._eformName, "Dynamic"); if (paDs.Tables.Count > 0 && paDs.Tables[0].Rows.Count > 0) { DataView paDv = new DataView(paDs.Tables[0]); paDv.RowFilter = BOL.Pathology.ProcedureId + " = " + ((DataRowView)e.Item.DataItem)[BOL.Procedure.ProcedureId].ToString(); if (paDv.Count > 0) { Repeater linkedPathologies = (Repeater)e.Item.FindControl("linkedPathologies"); linkedPathologies.DataSource = paDv; linkedPathologies.DataBind(); } } } }
protected void ItemsList_OnItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { Literal PublishDate = (Literal)e.Item.FindControl("PublishDate"); HyperLink Link = (HyperLink)e.Item.FindControl("Link"); HyperLink Title = (HyperLink)e.Item.FindControl("Title"); Literal ShortDesc = (Literal)e.Item.FindControl("ShortDesc"); HtmlContainerControl PostDesc = (HtmlContainerControl)e.Item.FindControl("PostDesc"); PostDesc.Visible = this.ShowPostDescription; RssItem item = (RssItem)e.Item.DataItem; PublishDate.Text = item.PubDate; Link.NavigateUrl = item.Link; Title.Text = item.Title; Title.NavigateUrl = item.Link; string shortDesc = item.Description; if (item.Description.Length > 130) { shortDesc = item.Description.Substring(0, 120) + "..."; } ShortDesc.Text = shortDesc; } }
/// <summary> /// Process [Bug(...)]. /// </summary> /// <param name="l">A KnownBugLogMessage object.</param> private void ProcessBug(LogMessage l) { HtmlContainerControl container = new HtmlDiv(); container.Padding.All = 4; container.BackgroundColor = Color.AnotherLightGray; HtmlContainerControl header = new HtmlDiv(); header.InnerHtml = "This test has a known issue:"; HtmlContainerControl message = CreateText(); message.BorderStyle = BorderStyle.Solid; message.BorderWidth = 1; message.BorderColor = Color.VeryLightGray; message.BackgroundColor = Color.White; message.InnerHtml = l.Message; message.Padding.All = 2; container.Padding.All = 2; message.Margin.All = 2; container.Controls.Add(header); container.Controls.Add(message); LogContainer.Controls.Add(container); }
/// ----------------------------------------------------------------------------- /// <summary> /// Constructs a new Pane object from the Control in the Skin /// </summary> /// <param name="pane">The HtmlContainerControl in the Skin.</param> /// ----------------------------------------------------------------------------- public Pane(HtmlContainerControl pane) { PaneControl = pane; //Disable ViewState (we enable it later in the process) PaneControl.ViewStateMode = ViewStateMode.Disabled; Name = pane.ID; }
protected void ItemCommandRep(Object sender, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "MultiDeleteButton": DeleteChecked.MultiDelete(this.NewRepNotes.MultiDeleteListArray, "Base_notes"); FillRep(); break; case "modifyNote": HtmlContainerControl ViewText = (HtmlContainerControl)e.Item.FindControl("ViewText"); if (!ViewText.Visible) { ViewText.Visible = true; } else { ViewText.Visible = false; } break; case "noteSubmit": Literal IDApp = (Literal)e.Item.FindControl("IDApp"); TextBox AreaText = (TextBox)e.Item.FindControl("AreaText"); DatabaseConnection.DoCommand("UPDATE BASE_NOTES SET BODY = '" + DatabaseConnection.FilterInjection(AreaText.Text) + "' WHERE ID =" + int.Parse(IDApp.Text)); FillRep(); break; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { EntUsuario user = (EntUsuario)Session["USUARIO"]; if (user != null) { Label lbl = (Label)Master.FindControl("lblUsuario"); lbl.Text = "Bienvenido " + user.nombre; HtmlContainerControl lblModal = (HtmlContainerControl)Master.FindControl("lblModal"); lblModal.InnerText = ""; } else { Response.Redirect("Cinepol.aspx"); } ViewState["ORDEN"] = "ASC"; //Aqui guaramos el orden ascendente de las peliculas para el gridview ViewState["COLUM"] = "nombre"; CargarGridPelicula(null, "", ""); } } catch (Exception ex) { MostrarMensaje(ex.Message); } }
protected void grdvTerritory_RowDataBound(object sender, GridViewRowEventArgs e) { GridViewRow row = e.Row; if (row.DataItem == null) { return; } GridView gvSalesRepTerritory = new GridView(); gvSalesRepTerritory = (GridView)row.FindControl("grdvSalesRepTerritory"); DataTable dt = (DataTable)ViewState["TerritoryTbl"]; string TerritoryID = ((DataRowView)e.Row.DataItem)["TerritoryID"].ToString(); dt.DefaultView.RowFilter = "ParentTerritoryID = " + TerritoryID; DataTable dtSalesRepTerritory = dt.DefaultView.ToTable(); HtmlContainerControl divExpandCollapse = (HtmlContainerControl)row.FindControl("divExpandCollapse"); if (dtSalesRepTerritory.Rows.Count > 0) { gvSalesRepTerritory.DataSource = dtSalesRepTerritory; gvSalesRepTerritory.DataBind(); divExpandCollapse.Style.Add(HtmlTextWriterStyle.Display, "block"); } else { gvSalesRepTerritory.DataSource = null; gvSalesRepTerritory.DataBind(); divExpandCollapse.Style.Add(HtmlTextWriterStyle.Display, "none"); } }
protected void dlShoppingCart_OnItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Label lblSkuCode = e.Item.FindControl("lblSkuCode") as Label; Label lblSkuDescription = e.Item.FindControl("lblSkuDescription") as Label; TextBox txtQuantity = e.Item.FindControl("txtQuantity") as TextBox; Label lblSkuInitialPrice = e.Item.FindControl("lblSkuInitialPrice") as Label; ImageButton btnRemoveItem = e.Item.FindControl("btnRemoveItem") as ImageButton; HtmlContainerControl holderQuantity = e.Item.FindControl("holderQuantity") as HtmlContainerControl; HtmlContainerControl holderRemove = e.Item.FindControl("holderRemove") as HtmlContainerControl; Image imgProduct = e.Item.FindControl("imgProduct") as Image; Sku cartItem = e.Item.DataItem as Sku; lblSkuDescription.Text = cartItem.LongDescription; lblSkuInitialPrice.Text = String.Format("${0:0.##}", cartItem.InitialPrice); lblSkuCode.Text = cartItem.SkuCode.ToString(); txtQuantity.Text = cartItem.Quantity.ToString(); btnRemoveItem.CommandArgument = cartItem.SkuId.ToString(); if (HideRemoveButton) { holderRemove.Visible = false; } } }
protected void dlTemplateList_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Template Item = (Template)e.Item.DataItem; HtmlContainerControl holderQuantity = e.Item.FindControl("holderExpireDate") as HtmlContainerControl; LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton; Label lblExpireDate = e.Item.FindControl("lblExpireDate") as Label; if (Item.ExpireDate.Value.Year != 2079) { lblExpireDate.Text = Item.ExpireDate.ToString(); } if (DateTime.Compare(DateTime.Now, (DateTime)Item.ExpireDate) > 0) { holderQuantity.Attributes.Add("style", "color: #ff0000;"); } if (Item.HideRemove) { lbRemove.Visible = false; } } }
internal static void SetPartyNameAndLink(string partyKey, HtmlContainerControl partyNameControl) { var partyName = Parties.GetPartyName(partyKey); var partyCode = Parties.GetPartyCode(partyKey); if (!IsNullOrWhiteSpace(partyName)) { var displayPartyName = partyName; if (!IsNullOrWhiteSpace(partyCode)) { displayPartyName += " (" + partyCode + ")"; } var webSite = Parties.GetPartyUrl(partyKey); partyNameControl.Controls.Clear(); partyNameControl.InnerHtml = Empty; if (IsNullOrWhiteSpace(webSite)) { partyNameControl.InnerText = displayPartyName; } else { new HtmlAnchor { InnerText = displayPartyName, HRef = NormalizeUrl(webSite), Title = "Visit the " + partyName + " web site", Target = "View" } }.AddTo(partyNameControl, "tiptip");
/// <summary> /// Show System Message /// </summary> /// <param name="message">Enter The Message</param> /// <param name="type">The Type Of The Message S=Success F=Failed I=Info W=Warning</param> /// <param name="SEM">The Control that using to display The Message</param> /// <param name="plus">Message + another </param> public static void MSG(string message, char type, HtmlContainerControl SEM, bool plus) { HtmlGenericControl div = new HtmlGenericControl("div"); if (type == 'S') { div.InnerText = message; div.Attributes["class"] = "alert alert-success"; SEM.Controls.Add(div); } else if (type == 'F') { div.InnerText = " خطأ !!! -- " + message; div.Attributes["class"] = "alert alert-danger"; SEM.Controls.Add(div); } else if (type == 'I') { div.InnerText = " توضيح !!! -- " + message; div.Attributes["class"] = "alert alert-info"; SEM.Controls.Add(div); } else if (type == 'W') { div.InnerText = " تحذير !!! -- " + message; div.Attributes["class"] = "alert alert-warning"; SEM.Controls.Add(div); } SEM.Visible = true; }
/// <summary> /// Show System Message /// </summary> /// <param name="message">Enter The Message</param> /// <param name="type">The Type Of The Message S=Success F=Failed I=Info W=Warning</param> /// <param name="SEM">The Control that using to display The Message</param> public static void MSG(string message, char type, HtmlContainerControl SEM) { if (type == 'S') { SEM.InnerText = message; SEM.Attributes["class"] = "alert alert-success"; SEM.Visible = true; } else if (type == 'F') { SEM.InnerText = " خطأ !!! -- " + message; SEM.Attributes["class"] = "alert alert-danger"; SEM.Visible = true; } else if (type == 'I') { SEM.InnerText = " توضيح !!! -- " + message; SEM.Attributes["class"] = "alert alert-info"; SEM.Visible = true; } else if (type == 'W') { SEM.InnerText = " تنبيه !!! -- " + message; SEM.Attributes["class"] = "alert alert-warning"; SEM.Visible = true; } }
protected void grdViewEventActivity_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // HtmlContainerControl spnStatus = (HtmlContainerControl)e.Row.FindControl("spnStatus"); HtmlContainerControl spnMarkComplete = (HtmlContainerControl)e.Row.FindControl("spnMarkComplete"); if (spnStatus != null) { if (spnStatus.InnerHtml.Length > 0) { if (spnStatus.InnerHtml.Trim().Equals("Completed") || spnStatus.InnerHtml.Trim().Equals("Held")) { if (spnMarkComplete != null) { spnMarkComplete.InnerHtml = "<a href=\'#'>Completed</a>"; } } } } //<a href="javascript:ChangeActivityStatus('<%# DataBinder.Eval(Container.DataItem, "Type") %>',<%# DataBinder.Eval(Container.DataItem, "ID") %>);">Mark Complete</a> //HtmlAnchor aMarkedComplete = (HtmlAnchor)e.Row.FindControl("aMarkedComplete"); //strPrepareActionCol += " <span style=\"width:110px; float:left;\">• <a id='" + rowindex + "_MedicalHistory' href=\"/App/Franchisee/Technician/MedicalHistory.aspx?" + drvCurrent["MedicalHistoryURLQuStr"].ToString() + "\">Health Assessment</a><br /></span>"; } }
private void RepCompany_ItemDataBound(object sender, RepeaterItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Item: case ListItemType.AlternatingItem: HtmlContainerControl Company = (HtmlContainerControl)e.Item.FindControl("CompanyRep"); Company.InnerHtml = (string)DataBinder.Eval((DataRowView)e.Item.DataItem, "CompanyName"); if (Company.InnerHtml.Length > 40) { Regex rx = new Regex(@"(?s)\b.{1,39}\b"); Company.Attributes.Add("title", Company.InnerHtml); Company.InnerHtml = rx.Match(Company.InnerHtml) + "…"; Company.Attributes.Add("style", "cursor:help;"); } string setRef = "SetCompany('" + G.ParseJSString(Convert.ToString(DataBinder.Eval((DataRowView)e.Item.DataItem, "CompanyName"))) + "','" + Convert.ToString(DataBinder.Eval((DataRowView)e.Item.DataItem, "ID")) + "')"; Company.Attributes.Add("onclick", setRef); break; } }
protected void repUserRights_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = (DataRowView)e.Item.DataItem; DataRow dr = drv.Row; HtmlInputCheckBox chkro = (HtmlInputCheckBox)e.Item.FindControl("chkReadOnly"); HtmlGenericControl lblro = (HtmlGenericControl)e.Item.FindControl("lblRO"); HtmlContainerControl divMode = (HtmlContainerControl)e.Item.FindControl("divMode"); Label lbl = (Label)e.Item.FindControl("lblUsrRight"); Label lblDesc = (Label)e.Item.FindControl("lblRightComment"); if (!dr.IsNull("RIGHT_DESC")) { lbl.Text = dr["RIGHT_DESC"].ToString(); } if (lblro != null) { lblro.Attributes.Add("for", chkro.ClientID); } if (!dr.IsNull("HAS_MODE")) { divMode.Visible = (dr["HAS_MODE"].ToString().Equals("1")); } if (!dr.IsNull("COMMENTS")) { lblDesc.Text = dr["COMMENTS"].ToString(); } } }
/// <summary> /// 建立翻页代码,并返回当前页码 /// </summary> public static int GetPageIndexBuildPaged(int pageSize, int dataAmount, HtmlContainerControl hcc, string otherParam) { int pageIndex; int pageAmount = (dataAmount - 1) / pageSize + 1; if (StringUtil.IsDigit(HttpContext.Current.Request.QueryString["page"])) { pageIndex = Convert.ToInt32(HttpContext.Current.Request.QueryString["page"]); if (pageIndex < 1) { pageIndex = 1; } if (pageIndex > pageAmount) { pageIndex = pageAmount; } } else { pageIndex = 1; } string url = HttpContext.Current.Request.Path + "?page="; string deadHref = "javascript:void(0);"; string firstPageHref = (pageIndex == 1) ? deadHref : String.Format("{0}1{1}", url, otherParam); string prevPageHref = (pageIndex == 1) ? deadHref : url + (pageIndex - 1) + otherParam; string nextPageHref = (pageIndex == pageAmount) ? deadHref : url + (pageIndex + 1) + otherParam; string lastPageHref = (pageIndex == pageAmount) ? deadHref : url + pageAmount + otherParam; string pageGoScript = String.Format("javascript:window.location.href='{0}'+document.getElementById('txtpageindex').value+'{1}';", url, otherParam); hcc.InnerHtml = String.Format("共有<span style=\"color: #FF0000;\">{0}</span>条记录,当前第<span style=\"color: #FF0000;\">{1}</span>/<span style=\"color: #FF0000;\">{2}</span>页,每页<span style=\"color: #FF0000;\">{3}</span>条记录 <a href=\"{4}\">|<首页</a><a href=\"{5}\"> <上一页</a><a href=\"{6}\"> 下一页></a><a href=\"{7}\"> 尾页>|</a> 转到第<input Type=\"text\" ID=\"txtpageindex\" style=\"width: 25px;\" />页<input Type=\"button\" value=\"GO\" onclick=\"{8}\" />", dataAmount, pageIndex, pageAmount, pageSize, firstPageHref, prevPageHref, nextPageHref, lastPageHref, pageGoScript); return(pageIndex); }
/// <summary> /// Populates the control's innerHtml property with a non-breaking space if it has no content /// </summary> public static void PopulateBlankControl(HtmlContainerControl control) { if (StringUtils.IsBlank(control.InnerText)) { control.InnerHtml = " "; } }
private void CreateActionMenu(HtmlContainerControl menuContainer, IList <DataRow> responses, bool isNew) { menuContainer.Controls.Clear(); new HtmlSpan { InnerText = "Select action:" }.AddTo(menuContainer); var dropdown = new HtmlSelect().AddTo(menuContainer); var edit = dropdown.AddItem("Edit this response", "edit"); var add = dropdown.AddItem("Add another response to this question", "add"); var view = dropdown.AddItem("View or edit other responses to this question", "view"); if (responses.Count == 0) { menuContainer.AddCssClasses("hidden"); } else { menuContainer.RemoveCssClass("hidden"); } if (isNew && responses.Count > 0) { edit.Attributes.Add("disabled", "disabled"); add.Attributes.Add("selected", "selected"); } else { edit.Attributes.Add("selected", "selected"); if (responses.Count < 2) { view.Attributes.Add("disabled", "disabled"); } } }
protected void lvSlideShow_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { SlideShowImage slideShowImage = e.Item.DataItem as SlideShowImage; if (slideShowImage != null) { //HtmlAnchor anchorLinkUrl = e.Item.FindControl("anchorLinkUrl") as HtmlAnchor; //if (anchorLinkUrl != null) //{ // if (!string.IsNullOrEmpty(slideShowImage.LinkUrl)) // { // anchorLinkUrl.HRef = slideShowImage.LinkUrl; // } //} HtmlContainerControl liSlide = e.Item.FindControl("liSlide") as HtmlContainerControl; if (liSlide != null) { if (!string.IsNullOrEmpty(slideShowImage.LinkUrl)) { liSlide.Attributes["onclick"] = "window.location = '" + slideShowImage.LinkUrl + "';"; } } } } }
/// <summary> /// Verifies anchor list template /// </summary> /// <param name="listTitle">list title</param> /// <param name="listItemsToVerify">list items to be verified</param> public void VerifyAnchorListTemplate(string listTitleToVerify, Dictionary <string, string> listItemsToVerify) { //// verify list title HtmlContainerControl listTitleAnchor = this.EM.Lists.AnchorListFrontend.ListTitleWithAnchor.AssertIsPresent("list title anchor"); Assert.AreEqual(listTitleToVerify, listTitleAnchor.InnerText, "list title anchor"); //// verify unordered list of anchors HtmlUnorderedList listItemAnchors = this.EM.Lists.AnchorListFrontend.ListItemsUnorderedList.AssertIsPresent("unordered list of list items"); Assert.AreEqual(listItemAnchors.Items.Count(), listItemsToVerify.Count, "Expected and actual count of list items are not equal"); for (int i = 0; i < listItemsToVerify.Count; i++) { Assert.AreEqual(listItemsToVerify.Keys.ElementAt(i), listItemAnchors.Items[i].InnerText, "list item"); Assert.IsTrue(listItemAnchors.Items[i].ChildNodes[0].TagName.Equals("a")); } //// verify expanded list List <HtmlDiv> listItemDivs = this.EM.Lists.AnchorListFrontend.ListItemsDivs; Assert.IsNotNull(listItemDivs, "List of div elements is null"); Assert.AreEqual(listItemsToVerify.Count, listItemDivs.Count, "Expected and actual count of list items are not equal"); for (int i = 0; i < listItemsToVerify.Count; i++) { Assert.AreEqual(listItemsToVerify.Keys.ElementAt(i), listItemDivs[i].ChildNodes[0].InnerText, "list item title"); Assert.AreEqual(listItemsToVerify.Values.ElementAt(i), listItemDivs[i].ChildNodes[1].InnerText, "list item content"); Assert.AreEqual("Back to top", listItemDivs[i].ChildNodes[2].InnerText, "Back to top link"); listItemDivs[i].ChildNodes[0].As <HtmlContainerControl>().AssertIsPresent("list item title"); listItemDivs[i].ChildNodes[1].As <HtmlDiv>().AssertIsPresent("list item content"); listItemDivs[i].ChildNodes[2].As <HtmlContainerControl>().AssertIsPresent("list item content"); } }
/// <summary> /// Verifies pages list template on Bootstrap /// </summary> /// <param name="listTitle">list title</param> /// <param name="listItemsToVerify">list items to be verified</param> public void VerifyPagesListTemplateOnBootstrap(string listTitleToVerify, Dictionary <string, string> listItemsToVerify) { //// verify list title HtmlContainerControl listTitle = this.EM.Lists.PagesListFrontend.ListTitleLabel.AssertIsPresent("list title"); Assert.AreEqual(listTitleToVerify, listTitle.InnerText, "list title"); //// verify unordered list of links HtmlUnorderedList listItemLinks = this.EM.Lists.PagesListFrontend.ListItemsUnorderedList.AssertIsPresent("unordered list of list items"); Assert.AreEqual(listItemLinks.Items.Count(), listItemsToVerify.Count, "Expected and actual count of list items are not equal"); for (int i = 0; i < listItemsToVerify.Count; i++) { Assert.AreEqual(listItemsToVerify.Keys.ElementAt(i), listItemLinks.Items[i].InnerText, "list item title"); Assert.IsTrue(listItemLinks.Items[i].ChildNodes[0].TagName.Equals("a")); //// verify details of list item listItemLinks.Items[i].ChildNodes[0].As <HtmlAnchor>().Click(); ActiveBrowser.WaitForUrl("/lists/", true); HtmlDiv listItemDetails = this.EM.Lists.PagesListFrontend.ListItemsDivOnBootstrap.AssertIsPresent("list item details"); Assert.AreEqual(listItemsToVerify.Keys.ElementAt(i), listItemDetails.ChildNodes[0].InnerText, "list item title in details"); Assert.AreEqual(listItemsToVerify.Values.ElementAt(i), listItemDetails.ChildNodes[2].InnerText, "list item content in details"); //// go back to the main list page ActiveBrowser.GoBack(); } }
protected override void AttachChildControls() { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { Literal control = (Literal)this.FindControl("txtUserBindName"); HtmlInputText text = (HtmlInputText)this.FindControl("txtRealName"); HtmlInputText text2 = (HtmlInputText)this.FindControl("txtPhone"); HtmlInputText text3 = (HtmlInputText)this.FindControl("txtEmail"); HtmlInputHidden hidden = (HtmlInputHidden)this.FindControl("txtUserName"); HtmlInputText text4 = (HtmlInputText)this.FindControl("txtCardID"); this.imglogo = (HtmlImage)this.FindControl("imglogo"); this.Nickname = (HtmlContainerControl)this.FindControl("Nickname"); this.WeixinHead = (HtmlControl)this.FindControl("WeixinHead"); if (!string.IsNullOrEmpty(currentMember.UserHead)) { this.imglogo.Src = currentMember.UserHead; } this.Nickname.InnerText = currentMember.UserName; if (string.IsNullOrEmpty(currentMember.OpenId)) { this.WeixinHead.Attributes.Add("noOpenId", "true"); } control.SetWhenIsNotNull(currentMember.UserBindName); hidden.SetWhenIsNotNull(currentMember.UserName); text.SetWhenIsNotNull(currentMember.RealName); text2.SetWhenIsNotNull(currentMember.CellPhone); text3.SetWhenIsNotNull(currentMember.QQ); text4.SetWhenIsNotNull(currentMember.CardID); } PageTitle.AddSiteNameTitle("修改用户信息"); }
protected void rptItemCreated(Object sender, RepeaterItemEventArgs e) { // Only valid for actual repeater items if (e.Item.DataItem != null && (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)) { HtmlContainerControl moduleButtonDiv = e.Item.FindControl("moduleButtonDiv") as HtmlContainerControl; string moduleName = DataBinder.Eval(e.Item.DataItem, "TabName").ToString(); string path = DataBinder.Eval(e.Item.DataItem, "Path").ToString(); string patientRequired = DataBinder.Eval(e.Item.DataItem, "RequiresPatient").ToString(); // Determine client click event if (patientRequired.ToLower().Equals(bool.TrueString.ToLower())) //&& (Session[SessionKey.PatientId] == null || Session[SessionKey.PatientId].ToString().Length == 0)) { //path = "showSelectPatientPanel('" + moduleName +"')"; path = "showSelectPatientPanel('" + path + "')"; } else { // Resolve url to correct path string urlPath = Page.ResolveUrl("~/Core/" + path); path = "location.href = '" + urlPath + "';"; } // Onclick will handle redirecting to relevent section moduleButtonDiv.Attributes["onclick"] = path; } }
protected void rptProduct_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dataRowView = (DataRowView)e.Item.DataItem; HtmlContainerControl htmlContainerControl = e.Item.Controls[0].FindControl("countDownBackGroundImage") as HtmlContainerControl; ProductDetailsLink productDetailsLink = e.Item.Controls[0].FindControl("ProductDetailsLink3") as ProductDetailsLink; Image image = e.Item.Controls[0].FindControl("imageOver") as Image; image.Visible = false; DateTime?nullable = dataRowView["StartDate"].ToDateTime(); DateTime?nullable2 = dataRowView["EndDate"].ToDateTime(); int num = dataRowView["TotalCount"].ToInt(0); int num2 = dataRowView["BoughtCount"].ToInt(0); if (htmlContainerControl != null && productDetailsLink != null) { string text = "url(/Templates/pccommon/images/sub/buy/countdownpcover.png) no-repeat"; string text2 = "url(/Templates/pccommon/images/sub/buy/countdownpcwill.png) no-repeat"; string imageUrl = "/Templates/pccommon/images/sub/buy/countdownovertip.png"; if (nullable.Value >= DateTime.Now) { htmlContainerControl.Style.Add("background", "#66bb6a"); productDetailsLink.Text = "即将开始"; } else if (nullable.Value <= DateTime.Now && nullable2.Value >= DateTime.Now && num <= num2) { htmlContainerControl.Style.Add("background", "#b9b9b9"); productDetailsLink.Text = "已抢完"; image.ImageUrl = imageUrl; image.Visible = true; } } } }
protected void rpGroupEvents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { GroupPurchaseEvent groupEvent = e.Item.DataItem as GroupPurchaseEvent; if (groupEvent != null) { HtmlContainerControl liGroupItem = e.Item.Controls[1] as HtmlContainerControl; Label lblEventStatus = liGroupItem.FindControl("lblEventStatus") as Label; //判断当前团购活动状态,并标记页面颜色 switch (GroupPurchaseEvent.CheckGroupPurchaseEventStatus(groupEvent)) { case GroupEventStatus.EVENT_SUCCESS: liGroupItem.Attributes["class"] += " list-group-item-success"; lblEventStatus.Text = "团购成功"; break; case GroupEventStatus.EVENT_GOING: liGroupItem.Attributes["class"] += " list-group-item-info"; lblEventStatus.Text = "团购进行中"; break; case GroupEventStatus.EVENT_FAIL: liGroupItem.Attributes["class"] += " list-group-item-danger"; lblEventStatus.Text = "团购失败"; break; } } } }
public Modulos(DataRow fila) { this.nombre = fila["nombre_modulo"].ToString(); this.url_imagen = fila["irl_img_modelo"].ToString(); this.descripcion = "Sin Descripcion"; this.nombre_btn = "Ver Contenidos"; div = new HtmlGenericControl("div"); }
public Contenidoss(DataRow fila) { this.nombre_contenido = fila["nombre_contenido"].ToString(); this.descripcion_contenido = fila["descripcion_contenido"].ToString(); this.url_img_contenido = fila["url_img_contenido"].ToString(); this.nombre_boton = "Consultar prueba"; li = new HtmlGenericControl("li"); }
private void ClearMessageControl(HtmlContainerControl container) { try { container.InnerText = string.Empty; } catch { throw; } }
private void ClearErrorMessage(HtmlContainerControl HtmlContainer) { try { HtmlContainer.InnerText = string.Empty; } catch { throw; } }
protected void repColors_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { CheckBox lblCategoryName = (CheckBox)e.Item.FindControl("cblColors"); HtmlContainerControl small = (HtmlContainerControl)e.Item.FindControl("small"); small.Attributes.Add("style", "background-color:" + lblCategoryName.Text); } }
public static void DropDownsWork() { var dropdownWrapsAll = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlSpan>("class=~dropdown-wrap"); HtmlContainerControl[] currentValuesOfDeopdowns = new HtmlContainerControl[dropdownWrapsAll.Count]; HtmlContainerControl[] defaultValuesOfDeopdowns = new HtmlContainerControl[dropdownWrapsAll.Count]; //string[] currentDefaultValuesOfDeopdowns = new string[dropdownnWrapAll.Count]; var divWithDropdownsOptions = TTFDriver.myManager.ActiveBrowser.Find.AllByAttributes<HtmlDiv>("data-role=popup"); for (int i = 0; i < dropdownWrapsAll.Count; i++) { defaultValuesOfDeopdowns[i] = divWithDropdownsOptions[i].Find.ByTagIndex<HtmlDiv>("div", 0); currentValuesOfDeopdowns[i] = dropdownWrapsAll[i].Find.ByTagIndex<HtmlSpan>("span", 0); } int[] countOptionsInEachDropdown = new int[divWithDropdownsOptions.Count]; HtmlContainerControl[][] arraysWithValuesOfOptions = new HtmlContainerControl[divWithDropdownsOptions.Count][]; for (int i = 0; i < divWithDropdownsOptions.Count; i++) { countOptionsInEachDropdown[i] = divWithDropdownsOptions[i].Find.AllByTagName<HtmlContainerControl>("li").Count; arraysWithValuesOfOptions[i] = new HtmlContainerControl[countOptionsInEachDropdown[i]+1]; for (int j = 0; j < countOptionsInEachDropdown[i]+1; j++) { arraysWithValuesOfOptions[i][j] = divWithDropdownsOptions[i].Find.ByTagIndex<HtmlContainerControl>("li", j); if (j == countOptionsInEachDropdown[i]) { arraysWithValuesOfOptions[i][j] = defaultValuesOfDeopdowns[i]; } } } Random rnd = new Random(); int randomNumber; for (int i = 0; i < dropdownWrapsAll.Count; i++) { if (currentValuesOfDeopdowns[i].TextContent == defaultValuesOfDeopdowns[i].TextContent) { //for (int j = 0; j < arraysWithValuesOfOptions[i].Count(); j++) //{ // var optionValueAsCurrent = Array.Find(arraysWithValuesOfOptions[i], p => p.InnerText.Contains(currentValuesOfDeopdowns[i].TextContent)); // int valueOfAtribute = int.Parse(optionValueAsCurrent.Attributes.Single(xx => xx.Name == "data-index").Value); //do randomNumber = (int)rnd.Next(arraysWithValuesOfOptions[i].Count()); //while (randomNumber == valueOfAtribute); randomNumber = (int)rnd.Next(arraysWithValuesOfOptions[i].Count()); var newOptionValueAsCurrent = Array.Find(arraysWithValuesOfOptions[i], p => p.Attributes.Single(xx => xx.Name == "data-index").Value.Contains(randomNumber.ToString())); newOptionValueAsCurrent.Click(); } var b = arraysWithValuesOfOptions[i].Where(x => x.TextContent.Contains("dfsd")); } }
protected void Page_Load(object sender, EventArgs e) { this.usrCaption.CustomizationAvailable = false; ver1 = PXFormView1.FindControl("ver1") as PXLabel; ver2 = PXFormView1.FindControl("ver2") as PXLabel; content1 = PXFormView1.FindControl("content1") as HtmlContainerControl; content2 = PXFormView1.FindControl("content2") as HtmlContainerControl; this.usrCaption.ScreenID = "WI.00.00.50"; ver1.Text = Request.QueryString["id1"]; ver2.Text = Request.QueryString["id2"]; Guid pageID = PX.Common.GUID.CreateGuid(Request.QueryString["pageID"])?? Guid.Empty; int id1 = 0; int id2 = 0; if (!string.IsNullOrEmpty(ver1.Text) && !Int32.TryParse(ver1.Text, out id1)) id1 = 0; if (!string.IsNullOrEmpty(ver2.Text) && !Int32.TryParse(ver2.Text, out id2)) id2 = 0; string art1, art2; bool docompare = true; art1 = GetArticle(pageID, id1, ver1, this.pnlStatLeft); CollectLeftStats(art1); art2 = GetArticle(pageID, id2, ver2, this.pnlStatRight); CollectRightStats(art2); if (string.IsNullOrEmpty(art1)) { art1 = PX.Data.PXMessages.LocalizeNoPrefix(PX.SM.Messages.SourceArticle); docompare = false; } if (string.IsNullOrEmpty(art2)) { art2 = PX.Data.PXMessages.LocalizeNoPrefix(PX.SM.Messages.DestinationArticle); docompare = false; } if(docompare) CompareArticles(art1, art2, ref art1, ref art2); this.content1.InnerHtml = art1; this.content2.InnerHtml = art2; }