public IHtmlNode HiddenInputTag() { IHtmlNode input = new HtmlTag("input") .Attributes(new { type = "text", style = "display:none" }); if (Component.Name.HasValue()) input.Attributes(new { name = Component.Name, id = Component.Id + "-value" }); if(Component.Items.Any()) input.Attribute("value", Component.Items[Component.SelectedIndex].Value); return input; }
public IHtmlNode HiddenInputTag() { IHtmlNode input = new HtmlTag("input") .Attributes(new { type = "text", style="display:none" }); if (Component.Items.Any() && Component.SelectedIndex != -1) { input.Attribute("value", Component.Items[Component.SelectedIndex].Value); } if (Component.Name.HasValue()) { input.Attributes(new { name = Component.Name, id = Component.Id + "-value" }); string value = Component.ViewContext.Controller.ValueOf<string>(Component.Name); if (value.HasValue()) { input.Attribute("value", value); } } return input; }
public IHtmlNode InnerContentTag() { IHtmlNode root = new HtmlTag("div").AddClass("t-dropdown-wrap t-state-default"); IHtmlNode input = new HtmlTag("input") .Attributes(new { type = "text", title = Component.Id }) .Attributes(Component.InputHtmlAttributes) .PrependClass(UIPrimitives.Input) .AppendTo(root); if(Component.Items.Any() && Component.SelectedIndex != -1) { input.Attribute("value", Component.Items[Component.SelectedIndex].Text); } if (Component.Id.HasValue()) { input.Attributes(new { id = Component.Id + "-input", name = Component.Name + "-input" }); string value = Component.ViewContext.Controller.ValueOf<string>(Component.Name + "-input"); if (value.HasValue()) { input.Attribute("value", value); } } IHtmlNode link = new HtmlTag("span").AddClass("t-select", UIPrimitives.Header); new HtmlTag("span").AddClass(UIPrimitives.Icon, "t-arrow-down").Html("select").AppendTo(link); link.AppendTo(root); return root; }