protected override void AttachChildControls() { int.TryParse(this.Page.Request.QueryString["supplierId"], out this.supplierId); this.rptsuppliercouponlist = (System.Web.UI.WebControls.Repeater) this.FindControl("rptsuppliercouponlist"); this.div = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("showcoupon"); BindList(); }
public static void HelpLink(System.Web.UI.HtmlControls.HtmlControl htmlControl, string helpLabel, string helpHref, string helpText = null, bool helpHrefIsJS = false) { System.Web.UI.WebControls.Panel panel; int id = new System.Random().Next(); panel = new System.Web.UI.WebControls.Panel { ID = "panel_help_" + id, CssClass = "col margin-top s12" }; if (helpText != null) { panel.Controls.Add(new System.Web.UI.WebControls.Label { ID = "help_text" + id, Text = helpText, CssClass = "col text-red label padding-16 margin-bottom" }); } panel.Controls.Add(new System.Web.UI.WebControls.HyperLink { ID = "help_link" + id, NavigateUrl = helpHrefIsJS ? string.Concat("javascript:", helpHref, "();") : helpHref, Text = helpLabel, CssClass = "text-blue hover-blue", }); htmlControl.Controls.Add(panel); }
/// <summary> /// 增加表头 /// </summary> /// <param name = "strTableTitle"></param> /// <param name = "tb"></param> public void CreateTitle(System.Web.UI.HtmlControls.HtmlControl ct, params string[] strTableTitle) { TableRow tr; TableCell htc; Label lblData; // tr = new TableRow(); htc = new TableCell(); htc.Controls.Add(ct); tr.Controls.Add(htc); // for (int i = 0; i < strTableTitle.Length; i++) { htc = new TableCell(); lblData = new Label(); lblData.ID = "label_" + mtb.ID + i.ToString(); lblData.EnableViewState = false; lblData.Text = strTableTitle[i]; htc.Controls.Add(lblData); tr.Controls.Add(htc); } mtb.Controls.Add(tr); SetWidth(); }
/// <summary> /// Removes a CSS class name from an html control. /// </summary> /// <param name="htmlControl">The html control.</param> /// <param name="className">Name of the class.</param> public static void RemoveCssClass(this System.Web.UI.HtmlControls.HtmlControl htmlControl, string className) { string match = @"\s*\b" + className + @"\b"; string css = htmlControl.Attributes["class"] ?? string.Empty; if (Regex.IsMatch(css, match, RegexOptions.IgnoreCase)) { htmlControl.Attributes["class"] = Regex.Replace(css, match, "", RegexOptions.IgnoreCase); } }
/// <summary> /// Determines whether the html control's CssClass includes the specified className /// </summary> /// <param name="htmlControl">The HTML control.</param> /// <param name="className">Name of the class.</param> /// <returns><c>true</c> if [has CSS class] [the specified class name]; otherwise, <c>false</c>.</returns> public static bool HasCssClass(this System.Web.UI.HtmlControls.HtmlControl htmlControl, string className) { if (className.IsNullOrWhiteSpace() || htmlControl == null) { return(false); } string css = htmlControl.Attributes["class"] ?? string.Empty; string match = @"(^|\s+)" + className + @"($|\s+)"; return(Regex.IsMatch(css, match, RegexOptions.IgnoreCase)); }
/// <summary> /// Removes a CSS class name from an html control. /// </summary> /// <param name="htmlControl">The html control.</param> /// <param name="className">Name of the class.</param> public static void RemoveCssClass(this System.Web.UI.HtmlControls.HtmlControl htmlControl, string className) { if (className.IsNullOrWhiteSpace() || htmlControl.Attributes["class"].IsNullOrWhiteSpace()) { return; } string match = $"\\s*\\b{className}\\b"; string css = htmlControl.Attributes["class"] ?? string.Empty; //the internals of regex.replace do a match before trying a replace. https://referencesource.microsoft.com/#System/regex/system/text/regularexpressions/RegexReplacement.cs,261 htmlControl.Attributes["class"] = Regex.Replace(css, match, "", RegexOptions.IgnoreCase); }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId)) { base.GotoResourceNotFound(); } this.txtEmail = (System.Web.UI.WebControls.TextBox) this.FindControl("txtEmail"); this.txtUserName = (System.Web.UI.WebControls.TextBox) this.FindControl("txtUserName"); this.txtContent = (System.Web.UI.WebControls.TextBox) this.FindControl("txtContent"); this.btnRefer = ButtonManager.Create(this.FindControl("btnRefer")); this.spReviewUserName = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spReviewUserName"); this.spReviewPsw = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spReviewPsw"); this.spReviewReg = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spReviewReg"); this.txtReviewUserName = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtReviewUserName"); this.txtReviewPsw = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtReviewPsw"); this.txtReviewCode = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtReviewCode"); this.productdetailLink = (ProductDetailsLink)this.FindControl("ProductDetailsLink1"); this.btnRefer.Click += new System.EventHandler(this.btnRefer_Click); if (!this.Page.IsPostBack) { PageTitle.AddSiteNameTitle("商品评论", Hidistro.Membership.Context.HiContext.Current.Context); if (Hidistro.Membership.Context.HiContext.Current.User.UserRole == Hidistro.Membership.Core.Enums.UserRole.Member || Hidistro.Membership.Context.HiContext.Current.User.UserRole == Hidistro.Membership.Core.Enums.UserRole.Underling) { this.txtUserName.Text = Hidistro.Membership.Context.HiContext.Current.User.Username; this.txtEmail.Text = Hidistro.Membership.Context.HiContext.Current.User.Email; this.txtReviewUserName.Value = string.Empty; this.txtReviewPsw.Value = string.Empty; this.spReviewUserName.Visible = false; this.spReviewPsw.Visible = false; this.spReviewReg.Visible = false; this.btnRefer.Text = "评论"; } else { this.spReviewUserName.Visible = true; this.spReviewPsw.Visible = true; this.spReviewReg.Visible = true; this.btnRefer.Text = "登录并评论"; } this.txtReviewCode.Value = string.Empty; ProductInfo productSimpleInfo = ProductBrowser.GetProductSimpleInfo(this.productId); if (productSimpleInfo != null) { this.productdetailLink.ProductId = this.productId; this.productdetailLink.ProductName = productSimpleInfo.ProductName; } } }
protected override void AttachChildControls() { int.TryParse(this.Page.Request.QueryString["supplierId"], out this.supplierId); this.rptHotSale = (System.Web.UI.WebControls.Repeater) this.FindControl("rptHotSale"); this.div = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("showhotsale"); string index = Context.Request.QueryString["pageIndex"]; int.TryParse(index, out pageIndex); if (pageIndex == 0) { this.BindList(); } else { BindList(pageIndex); } }
public void AddCell(System.Web.UI.HtmlControls.HtmlControl ct, string strText, params string[] strLoc) { TableCell tbcl = new TableCell(); tbcl.Controls.Add(ct); if (strLoc.Length >= 1) { tbcl.Attributes["align"] = strLoc[0]; } if (strLoc.Length >= 2) { tbcl.Attributes["bgcolor"] = strLoc[1]; } if (strLoc.Length >= 3) { tbcl.Style["width"] = strLoc[2]; //iRecLength += int.Parse(strLoc[2]); } tr.Controls.Add(tbcl); }
/// <summary> /// Displays any club schedules for this aircraft /// <paramref name="ac">The aircraft</paramref> /// <paramref name="rowClubSchedules">The row to show/hide if there are clubs found</paramref> /// <paramref name="rptSchedules">The repeater control for any clubs</paramref> /// <paramref name="setOwner">An action to take if the club has an owner name prepend policy</paramref> /// </summary> protected void SetUpSchedules(Aircraft ac, Repeater rptSchedules, System.Web.UI.HtmlControls.HtmlControl rowClubSchedules, Action <string> setOwner) { if (ac == null) { throw new ArgumentNullException(nameof(ac)); } if (!Page.User.Identity.IsAuthenticated || ac.IsNew) { return; } if (rptSchedules == null) { throw new ArgumentNullException(nameof(rptSchedules)); } if (rowClubSchedules == null) { throw new ArgumentNullException(nameof(rowClubSchedules)); } List <MyFlightbook.Clubs.Club> lstClubs = new List <MyFlightbook.Clubs.Club>(MyFlightbook.Clubs.Club.ClubsForAircraft(ac.AircraftID, Page.User.Identity.Name)); if (lstClubs.Count > 0) { rowClubSchedules.Visible = true; rptSchedules.DataSource = lstClubs; rptSchedules.DataBind(); // If *any* club has policy PrependsScheduleWithOwnerName, set the default text for it foreach (MyFlightbook.Clubs.Club c in lstClubs) { if (c.PrependsScheduleWithOwnerName) { setOwner?.Invoke(Profile.GetUser(Page.User.Identity.Name).UserFullName); break; } } } }
/// <summary> /// Adds a CSS class name to an html control, will not add duplicates. /// </summary> /// <param name="htmlControl">The html control.</param> /// <param name="className">Name of the class.</param> public static void AddCssClass(this System.Web.UI.HtmlControls.HtmlControl htmlControl, string className) { if (className.IsNullOrWhiteSpace()) { return; } string css = htmlControl.Attributes["class"] ?? string.Empty; if (css.IsNullOrWhiteSpace()) { htmlControl.Attributes["class"] = className; return; } string pattern = $"\\b{className}\\b"; if (!Regex.IsMatch(css, pattern, RegexOptions.IgnoreCase)) { htmlControl.Attributes["class"] += $" {className}"; } }
protected override void AttachChildControls() { this.rptLeaveComments = (ThemedTemplatedRepeater)this.FindControl("rptLeaveComments"); this.pager = (Pager)this.FindControl("pager"); this.txtTitle = (System.Web.UI.WebControls.TextBox) this.FindControl("txtTitle"); this.txtUserName = (System.Web.UI.WebControls.TextBox) this.FindControl("txtUserName"); this.txtContent = (System.Web.UI.WebControls.TextBox) this.FindControl("txtContent"); this.btnRefer = ButtonManager.Create(this.FindControl("btnRefer")); this.spLeaveUserName = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spLeaveUserName"); this.spLeavePsw = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spLeavePsw"); this.spLeaveReg = (System.Web.UI.HtmlControls.HtmlControl) this.FindControl("spLeaveReg"); this.txtLeaveUserName = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtLeaveUserName"); this.txtLeavePsw = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtLeavePsw"); this.txtLeaveCode = (System.Web.UI.HtmlControls.HtmlInputText) this.FindControl("txtLeaveCode"); this.btnRefer.Click += new System.EventHandler(this.btnRefer_Click); PageTitle.AddSiteNameTitle("客户留言", Hidistro.Membership.Context.HiContext.Current.Context); if (Hidistro.Membership.Context.HiContext.Current.User.UserRole == Hidistro.Membership.Core.Enums.UserRole.Member || Hidistro.Membership.Context.HiContext.Current.User.UserRole == Hidistro.Membership.Core.Enums.UserRole.Underling) { this.txtUserName.Text = Hidistro.Membership.Context.HiContext.Current.User.Username; this.txtLeaveUserName.Value = string.Empty; this.txtLeavePsw.Value = string.Empty; this.spLeaveUserName.Visible = false; this.spLeavePsw.Visible = false; this.spLeaveReg.Visible = false; this.btnRefer.Text = "发表"; } else { this.spLeaveUserName.Visible = true; this.spLeavePsw.Visible = true; this.spLeaveReg.Visible = true; this.btnRefer.Text = "登录并留言"; } this.txtLeaveCode.Value = string.Empty; this.BindList(); }
/// <summary> /// 绑定每一行 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void repeaterTableList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //取试题类型 Label lblAskCategory = e.Item.FindControl("lblAskCategory") as Label; string AskCategory = lblAskCategory.Text.Trim(); //取单选 System.Web.UI.HtmlControls.HtmlControl ulRadio = (System.Web.UI.HtmlControls.HtmlControl)e.Item.FindControl("ulRadio"); Repeater repeaterRadio = e.Item.FindControl("repeaterRadio") as Repeater; //取多选 System.Web.UI.HtmlControls.HtmlControl ulCheckBox = (System.Web.UI.HtmlControls.HtmlControl)e.Item.FindControl("ulCheckBox"); Repeater repeaterCheckBox = e.Item.FindControl("repeaterCheckBox") as Repeater; //取文本 System.Web.UI.HtmlControls.HtmlControl ulText = (System.Web.UI.HtmlControls.HtmlControl)e.Item.FindControl("ulText"); //单选矩阵 System.Web.UI.HtmlControls.HtmlControl liMatrixRadio = (System.Web.UI.HtmlControls.HtmlControl)e.Item.FindControl("liMatrixRadio"); //下拉矩阵 System.Web.UI.HtmlControls.HtmlControl liMatrixDropDown = (System.Web.UI.HtmlControls.HtmlControl)e.Item.FindControl("liMatrixDropDown"); //取试题ID Label lblSQID = e.Item.FindControl("lblSQID") as Label; string SQID = lblSQID.Text.Trim(); //根据题取选项 DataTable SuryOptionDt = null; QuerySurveyOption query = new QuerySurveyOption(); query.SQID = Convert.ToInt32(SQID); query.Status = 0; int allcount = 0; SuryOptionDt = BLL.SurveyOption.Instance.GetSurveyOption(query, "OrderNum", 1, 100000, out allcount); //判断该行属于哪种题型 if (Convert.ToInt32(AskCategory) == (Int32)BitAuto.ISDC.CC2012.Entities.AskCategory.RadioT) { ulRadio.Visible = true; repeaterRadio.DataSource = SuryOptionDt; repeaterRadio.DataBind(); } else if (Convert.ToInt32(AskCategory) == (Int32)BitAuto.ISDC.CC2012.Entities.AskCategory.CheckBoxT) { ulCheckBox.Visible = true; repeaterCheckBox.DataSource = SuryOptionDt; repeaterCheckBox.DataBind(); } else if (Convert.ToInt32(AskCategory) == (Int32)BitAuto.ISDC.CC2012.Entities.AskCategory.TextT) { ulText.Visible = true; } //如果是单选矩阵 else if (Convert.ToInt32(AskCategory) == (Int32)BitAuto.ISDC.CC2012.Entities.AskCategory.MatrixRadioT) { #region 绑定单选矩阵 liMatrixRadio.Visible = true; #endregion } //如果是下拉选矩阵 else if (Convert.ToInt32(AskCategory) == (Int32)BitAuto.ISDC.CC2012.Entities.AskCategory.MatrixDropDownT) { #region 绑定下拉矩阵 liMatrixDropDown.Visible = true; #endregion } } }
private void InitializeCarePlanGoal() { Client.Core.Individual.Case.MemberCaseCarePlanGoal carePlanGoal = CarePlanGoal; if (carePlanGoal == null) { return; } System.Web.UI.HtmlControls.HtmlControl titlePanel = (System.Web.UI.HtmlControls.HtmlControl)FindControl("TitlePanel_" + carePlanGoal.MemberCaseCarePlan.Status.ToString()); if (titlePanel != null) { titlePanel.Visible = true; } // MAP PROPERTY VALUES INTO CONTROLS CarePlanGoalEditName.Text = CarePlanGoalName.Text = carePlanGoal.Name; // CARE PLAN GOAL STATUS CarePlanGoalEditClinicalNarrative.Text = CarePlanGoalClinicalNarrative.Text = carePlanGoal.ClinicalNarrative; CarePlanGoalEditCommonNarrative.Text = CarePlanGoalCommonNarrative.Text = carePlanGoal.CommonNarrative; CarePlanGoalMeasureName.Text = carePlanGoal.CareMeasureName; CarePlanGoalMeasureName.ToolTip = (carePlanGoal.CareMeasure != null) ? carePlanGoal.CareMeasure.Description : String.Empty; // EDIT PANELS BASED ON CARE PLAN GOAL STATUS (GOAL STATUS IS MORE DETAILED THAN CARE PLAN STATUS) System.Web.UI.HtmlControls.HtmlControl carePlanGoalEditPanel = (System.Web.UI.HtmlControls.HtmlControl)FindControl("CarePlanGoalEditPanel_" + carePlanGoal.MemberCaseCarePlan.Status.ToString()); if (carePlanGoalEditPanel != null) { carePlanGoalEditPanel.Visible = true; } #region EDIT PANEL - UNDER DEVELOPMENT CarePlanGoalTimeframeSelection.SelectedValue = ((Int32)carePlanGoal.GoalTimeframe).ToString(); CarePlanGoalScheduleValue.Value = carePlanGoal.ScheduleValue; CarePlanGoalScheduleQualifierSelection.SelectedValue = ((Int32)carePlanGoal.ScheduleQualifier).ToString(); List <Client.Core.Individual.CareMeasure> careMeasuresAvailable = (from currentCareMeasure in MercuryApplication.CareMeasuresAvailable(true) where (((currentCareMeasure.Enabled) && (currentCareMeasure.Visible)) || (currentCareMeasure.Id == carePlanGoal.CareMeasureId)) select currentCareMeasure).ToList(); CarePlanGoalCareMeasureSelection.DataSource = careMeasuresAvailable; CarePlanGoalCareMeasureSelection.DataTextField = "Name"; CarePlanGoalCareMeasureSelection.DataValueField = "Id"; CarePlanGoalCareMeasureSelection.SelectedValue = carePlanGoal.CareMeasureId.ToString(); #endregion CarePlanGoalInterventionsGrid.Rebind(); return; }
protected override void SetCustomAttributes(Control container, System.Web.UI.HtmlControls.HtmlControl controlToDecorate) { controlToDecorate.Attributes["data-start-page-id"] = GetStartPageId(container).ToString(CultureInfo.InvariantCulture); }
/// <summary> /// For the given SurveyType pull all surveys, score, group and graph /// <param name="scalesRptr"></param> /// <param name="noSurveyMsg"></param> /// <param name="SurveyTypeMatch">The name of the Survey to match</param> /// <param name="breastQPoints"></param> /// </summary> protected void BuildReportCharts(Repeater scalesRptr, System.Web.UI.HtmlControls.HtmlControl noSurveyMsg, string SurveyTypeMatch, string SurveyTypeAlias, IEnumerable <BreastQPoint> breastQPoints) { var surveyByTypesAndScores = from p in breastQPoints // cleanup: flatten surveys (i.e., Tram 2 Month x2) group p by new { Type = p.SurveyType, Scale = p.ScaleName } into g select g.First(); var scoresByScale = from survey in surveyByTypesAndScores group survey by survey.ScaleName into scaleGroup let scaleName = scaleGroup.Key let scaleSurveys = scaleGroup.OrderBy(s => s.SurveyDateTicks) select new { // normalized scale name ScaleName = scaleName, // as IEnumerable<BreastQPoint> ScaleData = scaleSurveys, // as DataView ScaleDataView = ToDataView(scaleName, scaleSurveys.Select(s => new object[] { s.SurveyType, GetSurveyTypeTitle(s.SurveyType, SurveyTypeMatch), new DateTime(s.SurveyDateTicks), s.SurveyDateText, s.ScaleName, s.ScaleScore })) }; // SPECIAL CASE: extract special scales var specialScales = from scale in scoresByScale where BREASTQ_PROCESS_OF_CARE_SCALE.Keys.Contains(scale.ScaleName, StringComparer.OrdinalIgnoreCase) select scale; // STANDARD CASE: a list of standard scales to build var stdScales = from scale in scoresByScale where !BREASTQ_PROCESS_OF_CARE_SCALE.Keys.Contains(scale.ScaleName, StringComparer.OrdinalIgnoreCase) select scale; // BUILD: build specialized ProcessOfCare chart int lastIndex = stdScales.Count() - 1; scalesRptr.ItemDataBound += (r, e) => { // show process of care in footer if (e.Item.ItemType == ListItemType.Footer) { var ProcessOfCareChart = e.Item.FindControl("ProcessOfCareChart") as BaseBreastQChartControl; var ProcessOfCareLabel = e.Item.FindControl("ProcessOfCareLabel"); // get last scale var lastType = from scaleData in specialScales.SelectMany(s => s.ScaleData) orderby scaleData.SurveyDateTicks descending select scaleData.SurveyType; if (lastType.Count() > 0) { string lastSurveyType = lastType.First(); var data = from scale in specialScales from survey in scale.ScaleData where survey.SurveyType == lastSurveyType select survey; // process of care data point var processDataPoints = from scale in BREASTQ_PROCESS_OF_CARE_SCALE let scaleName = scale.Key let scaleColor = scale.Value let points = data.Where(s => s.ScaleName.Equals(scaleName, StringComparison.OrdinalIgnoreCase)) select new { Name = scaleName, Color = scaleColor, Points = points.ToDictionary(p => p.ScaleName, p => p.ScaleScore) }; var processDataSource = processDataPoints.ToDictionary(p => p.Color, p => p.Points); var _processDataPoints = from scale in BREASTQ_PROCESS_OF_CARE_SCALE let scaleName = scale.Key let scaleColor = scale.Value let points = data.Where(s => s.ScaleName.Equals(scaleName, StringComparison.OrdinalIgnoreCase)) let label = "" let axisLabel = scaleName.Replace("Satisfaction with", "") let xValue = scaleName let yValues = points.Select(p => (double)p.ScaleScore).ToArray() select new CaisisDataPoint(label, axisLabel, scaleColor, xValue, yValues); //ProcessOfCareChart.DataBindChart("Total BQ Score", processDataSource); ProcessOfCareChart.DataBindChart("Process Of Care: Satisfaction", "", "Total BQ Score", _processDataPoints); ProcessOfCareChart.Visible = true; ProcessOfCareLabel.Visible = false; } else { ProcessOfCareChart.Visible = false; ProcessOfCareLabel.Visible = true; } } }; // BUILD: build standard charts scalesRptr.DataSource = stdScales; scalesRptr.DataBind(); // show special message when no data found if (scoresByScale.Count() > 0) { noSurveyMsg.Visible = false; } }
public static void HtmlForm(System.Web.UI.HtmlControls.HtmlControl htmlControl, string[] fields, int[] widths, int[] lengths, string functionSubmit = null, string[] types = null) { System.Web.UI.WebControls.Panel panel; System.Web.UI.WebControls.Label label; System.Web.UI.WebControls.TextBox textBox; System.Web.UI.WebControls.Button button; functionSubmit = functionSubmit ?? "void(0)"; if (types == null) { types = new string[fields.Length]; for (int i = 0; i < fields.Length; i++) { types[i] = "t"; } } for (int i = 0; i < fields.Length; i++) { label = new System.Web.UI.WebControls.Label { ID = "label_" + i, Text = fields[i], CssClass = "label" }; textBox = new System.Web.UI.WebControls.TextBox { ID = ("field_" + fields[i]).Replace(" ", "_").ToLower(), MaxLength = lengths[i], CssClass = "input border", TextMode = types[i].Equals("pwd") ? System.Web.UI.WebControls.TextBoxMode.Password : System.Web.UI.WebControls.TextBoxMode.SingleLine }; panel = new System.Web.UI.WebControls.Panel { ID = "panel_" + i, CssClass = "col padding-16 s12 m" + widths[i] }; panel.Controls.Add(label); panel.Controls.Add(textBox); htmlControl.Controls.Add(panel); } panel = new System.Web.UI.WebControls.Panel { ID = "panel_submit", CssClass = "col padding-16 s12" }; button = new System.Web.UI.WebControls.Button { ID = "submit_form", CssClass = "button blue hover-blue-gray", Text = "Enviar dados", OnClientClick = functionSubmit }; panel.Controls.Add(button); htmlControl.Controls.Add(panel); }