protected override string WriteSelfStartTag(System.IO.TextWriter writer, IBootstrapContext context) { var tb = context.CreateTagBuilder("option"); if (ValueValue != null) { tb.MergeAttribute("value", ValueValue.ToString()); } if (DisabledValue) { tb.MergeAttribute("disabled", "disabled"); } var formGroup = context.PeekNearest <Select>(); var controlContext = formGroup == null ? null : formGroup.ControlContextValue; if (controlContext != null && controlContext.Value != null && ValueValue != null && ValueValue.ToString().Equals(controlContext.Value.ToString())) { tb.MergeAttribute("selected", "selected"); } ApplyCss(tb); ApplyAttributes(tb); tb.WriteStartTag(writer); return(tb.GetEndTag()); }
public static decimal GetDeliveryCost(long addressId) { try { Dictionary <string, string> res = new Dictionary <string, string>(); var basket = SessionBasket.GetBasket(); ArticleInfo[] prodInfo = new ArticleInfo[basket.Where(x => x.Key > 0).Count()]; int i = 0; foreach (var key in basket.Keys) { if (key > 0) { prodInfo[i] = new ArticleInfo(key, basket[key]); i++; } } DeliveryInfo delInfo = new DeliveryInfo(addressId, string.Empty); Hashtable pars = new Hashtable(); pars["Articles"] = prodInfo; pars["Delivery"] = delInfo; pars["ReserveOfficeId"] = 1; ValueValue order = GetObject <ValueValue>("GetDeliveryCost", pars); return(order.Value); } catch (Exception ex) { SessionErrors.Add(ex); throw ex; } }
protected override void WriteSelf(System.IO.TextWriter writer, IBootstrapContext context) { var formGroup = context.PeekNearest <FormGroup>(); if (formGroup != null && ControlContextValue == null) { ControlContextValue = formGroup.ControlContextValue; } ITagBuilder div = null; if (!InlineValue) { div = context.CreateTagBuilder("div"); div.AddCssClass("radio"); writer.Write(div.GetStartTag()); } var lbl = context.CreateTagBuilder("label"); if (InlineValue) { lbl.AddCssClass("radio-inline"); } writer.Write(lbl.GetStartTag()); var input = context.CreateTagBuilder("input"); input.MergeAttribute("type", "radio"); if (ControlContextValue != null) { input.MergeAttribute("id", ControlContextValue.Name); input.MergeAttribute("name", ControlContextValue.Name); input.MergeAttribute("value", ValueValue?.ToString()); var controlValue = ControlContextValue.Value; if (controlValue != null && ValueValue != null && ValueValue.ToString().Equals(controlValue.ToString())) { input.MergeAttribute("checked", "checked"); } } if (DisabledValue) { input.MergeAttribute("disabled", "disabled"); } ApplyCss(input); ApplyAttributes(input); ////input.MergeAttributes(helper.HtmlHelper.GetUnobtrusiveValidationAttributes(context.ExpressionText, context.Metadata)); writer.Write(input.GetFullTag()); writer.Write(" "); // writing space to separate text from radio itself writer.Write(context.HtmlEncode(TextValue)); writer.Write(lbl.GetEndTag()); if (div != null) { writer.Write(div.GetEndTag()); } }