public static MvcHtmlString BootstrapTextBoxFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > bindingExpresion, string name, string placeHolder, string title, string cssClass, object htmlAttributes = null) { RouteValueDictionary rvd = new RouteValueDictionary(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); if (!string.IsNullOrEmpty(name)) { HtmlCommonProperty.AddIdName(rvd, name, null); } if (!string.IsNullOrEmpty(placeHolder)) { rvd.Add("placeHolder", placeHolder); } if (!string.IsNullOrEmpty(title)) { rvd.Add("title", title); } if (string.IsNullOrEmpty(cssClass)) { cssClass = "form-control"; } else { cssClass = "form-control " + cssClass; } rvd.Add("class", cssClass); return(InputExtensions.TextBoxFor(htmlHelper, bindingExpresion, rvd)); }
public static IHtmlString TextBoxNew(this HtmlHelper <CATEGORYSAddViewModel> htmlHelper, CATEGORYSAddViewModel viewModel, int index) { var outerDiv = new TagBuilder("div"); outerDiv.AddCssClass("form-group row d-flex align-items-center mb-5"); var label = new TagBuilder("label"); label.AddCssClass("col-lg-2 form-control-label d-flex justify-content-lg-end"); label.Attributes.Add("for", "vudoan"); var textboxValue = InputExtensions.TextBoxFor(htmlHelper, m => m.COMPLEMENTS[index].FIELD_VALUE, new { @class = "form-control", placeholder = viewModel.COMPLEMENTS[index].PLACEHOLDER, type = "SingleLine" }); var textboxName = InputExtensions.TextBoxFor(htmlHelper, m => m.COMPLEMENTS[index].FIELD_NAME, new { @class = "checkbox-inline", type = "hidden" }); StringBuilder htmlBuilder = new StringBuilder(); if (viewModel.COMPLEMENTS[index].REQUIREDVALUE == true) { var span = new TagBuilder("span"); span.Attributes.Add("class", "required"); span.SetInnerText("*"); label.InnerHtml = htmlHelper.Encode(viewModel.COMPLEMENTS[index].LABEL_NAME) + span.ToString(TagRenderMode.Normal); } else { label.SetInnerText(viewModel.COMPLEMENTS[index].LABEL_NAME); } htmlBuilder.Append(label.ToString(TagRenderMode.Normal)); htmlBuilder.Append("<div class=\"col-lg-6\">" + textboxValue.ToHtmlString() + "</div>"); htmlBuilder.Append(textboxName.ToHtmlString()); outerDiv.InnerHtml = htmlBuilder.ToString(); var html = outerDiv.ToString(TagRenderMode.Normal); return(MvcHtmlString.Create(html)); }
public static MvcHtmlString CheckBoxControlFor <TModel>(this HtmlHelper <TModel> html, Expression <Func <TModel, bool> > expression, Dictionary <string, object> innerHtmlAttributes) { var metaData = ModelMetadata.FromLambdaExpression(expression, html.ViewData); var htmlFieldName = ExpressionHelper.GetExpressionText(expression); return(CheckBoxControlHelper(html, expression, metaData, InputExtensions.CheckBoxFor(html, expression, innerHtmlAttributes))); }
public static IHtmlContent CheckBoxFor <TModel>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, bool> > expression, object htmlAttributes = null) { var result = InputExtensions.CheckBoxFor(htmlHelper, expression, htmlAttributes); return(Translate(result)); }
public static MvcHtmlString JQM_TextBoxFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, InputConfig config = null, IDictionary <string, object> htmlAttributes = null) { TagBuilder tagResult = new TagBuilder("div"); tagResult.MergeAttribute("class", "ui-field-contain"); if (config == null || (config != null && string.IsNullOrEmpty(config.PlaceHolder))) { tagResult.InnerHtml += LabelExtensions.LabelFor(htmlHelper, expression).ToHtmlString(); } if (htmlAttributes == null) { htmlAttributes = new Dictionary <string, object>(); } if (config != null) { foreach (var item in config.GetAttributes()) { if (htmlAttributes.Count(p => p.Key == item.Key) == 0) { htmlAttributes.Add(item); } } } tagResult.InnerHtml += InputExtensions.TextBoxFor(htmlHelper, expression, htmlAttributes).ToHtmlString(); tagResult.InnerHtml += ValidationExtensions.ValidationMessageFor(htmlHelper, expression).ToHtmlString(); return(tagResult.ToHtml()); }
public static IHtmlContent RadioButtonFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes = null) { var result = InputExtensions.RadioButtonFor(htmlHelper, expression, htmlAttributes); return(Translate(result)); }
/// <summary> /// Drop down list /// </summary> /// <typeparam name="TModel">TModel entity</typeparam> /// <typeparam name="TValue">TValue entity</typeparam> /// <param name="htmlHelper">html helper</param> /// <param name="expression">Expression field</param> /// <param name="selectList">Select list</param> /// <param name="htmlAttributes">html attributes</param> /// <param name="disabled">Disabled field</param> /// <returns>returns mvc html string</returns> public static MvcHtmlString DropDownListFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, IEnumerable <SelectListItem> selectList, object htmlAttributes, string disabled) { Func <TModel, TValue> deleg = expression.Compile(); var result = deleg(htmlHelper.ViewData.Model); if (string.IsNullOrEmpty(disabled)) { return(SelectExtensions.DropDownListFor(htmlHelper, expression, selectList, htmlAttributes)); } else { string name = ExpressionHelper.GetExpressionText(expression); string selectedText = SelectInternal(htmlHelper, name, selectList); RouteValueDictionary routeValues = new RouteValueDictionary(htmlAttributes); if (disabled == "disabled") { routeValues.Add("disabled", "disabled"); } else if (disabled == "readonly") { routeValues.Add("readonly", "read-only"); } return(InputExtensions.TextBox(htmlHelper, name, selectedText, routeValues)); } }
public static MvcHtmlString RadioButtonFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object value, IDictionary <string, object> htmlAttributes, bool bindNull) { MvcHtmlString mvcHtmlString; if (value == null && bindNull) { mvcHtmlString = InputExtensions.RadioButtonFor(htmlHelper, expression, "", htmlAttributes); var metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData); if (metadata.Model == null && mvcHtmlString.ToHtmlString().IndexOf(" checked=\"checked\" ") < 0) { var index = mvcHtmlString.ToHtmlString().IndexOf(" id="); return(new MvcHtmlString(mvcHtmlString.ToHtmlString().Insert(index, " checked=\"checked\""))); } } else { mvcHtmlString = InputExtensions.RadioButtonFor(htmlHelper, expression, value, htmlAttributes); } return(mvcHtmlString); }
public static MvcHtmlString BootstrapTextBox(this HtmlHelper htmlHelper, string name, string value, string placeHolder, string title, string cssClass, object htmlAttributes = null) { RouteValueDictionary rvd = new RouteValueDictionary(HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); if (!string.IsNullOrEmpty(placeHolder)) { rvd.Add("placeHolder", placeHolder); } if (!string.IsNullOrEmpty(title)) { rvd.Add("title", title); } if (string.IsNullOrEmpty(cssClass)) { cssClass = "form-control"; } else { cssClass = "fomr-control " + cssClass; } rvd.Add("class", cssClass); return(InputExtensions.TextBox(htmlHelper, name, value, rvd)); }
public static IHtmlString ImageUpload(this HtmlHelper <User> htmlHelper, User viewModel) { var outerDiv = new TagBuilder("div"); outerDiv.AddCssClass("pull-left upload-img-wrapper"); var label = new TagBuilder("label"); label.AddCssClass("upload-img"); label.MergeAttribute("data-content", "Change photo"); var image = new TagBuilder("img"); image.AddCssClass("img-responsive"); image.MergeAttribute("src", "../Images/no-user-image.png"); image.MergeAttribute("width", "250"); image.MergeAttribute("height", "250"); var textbox = InputExtensions.TextBoxFor(htmlHelper, m => ImageName, new { type = "file", style = "display:none" }); StringBuilder htmlBuilder = new StringBuilder(); htmlBuilder.Append(label.ToString(TagRenderMode.StartTag)); htmlBuilder.Append(image.ToString(TagRenderMode.Normal)); htmlBuilder.Append(label.ToString(TagRenderMode.EndTag)); // htmlBuilder.Append(textbox.ToHtmlString()); outerDiv.InnerHtml = htmlBuilder.ToString(); var html = outerDiv.ToString(TagRenderMode.Normal); return(MvcHtmlString.Create(html)); }
public static MvcHtmlString TextBoxFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string cssClass = null, string dir = null, bool disabled = false, string id = null, string lang = null, int?maxLength = null, bool readOnly = false, int?size = null, string style = null, int?tabIndex = null, string title = null) { return(InputExtensions.TextBoxFor( htmlHelper, expression, InputAttributes(cssClass, dir, disabled, id, lang, maxLength, readOnly, size, style, tabIndex, title) )); }
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, bool?isChecked = null, string cssClass = null, string dir = null, bool disabled = false, string id = null, string lang = null, int?maxLength = null, bool readOnly = false, int?size = null, string style = null, int?tabIndex = null, string title = null) { var htmlAttributes = InputAttributes(cssClass, dir, disabled, id, lang, maxLength, readOnly, size, style, tabIndex, title); return(isChecked.HasValue ? InputExtensions.RadioButton(htmlHelper, name, value, isChecked.Value, htmlAttributes) : InputExtensions.RadioButton(htmlHelper, name, value, htmlAttributes)); }
private static string CreateTextArea <T, U>(HtmlHelper <T> htmlHelper, ModelMetadata metadata, Expression <Func <T, U> > expression) { TagBuilder tagBuilder = new TagBuilder("div"); tagBuilder.MergeAttributes(HtmlHelper.AnonymousObjectToHtmlAttributes(new { id = metadata.PropertyName + "RichTextBox", @class = "richtextbox-textarea form-control", contenteditable = "true" })); tagBuilder.InnerHtml = InputExtensions.HiddenFor(htmlHelper, expression).ToString(); return(tagBuilder.ToString()); }
public static MvcHtmlString UploadFile <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes = null) { var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes) as IDictionary <string, object>; attributes.Add("type", "file"); return(InputExtensions.TextBoxFor <TModel, TProperty>(htmlHelper, expression, attributes)); }
public static MvcHtmlString BSFGForMetaData <TModel>( this HtmlHelper <TModel> html, MetaProduct meta, int num, int col_sm) { StringBuilder sb = new StringBuilder(); sb.AppendLine("<div class=\"form-group\">"); var name = (typeof(TypeOfMetaProduct).GetMember(meta.Type.ToString()).First().GetCustomAttributes(typeof(DisplayAttribute), true).First() as DisplayAttribute).Name; sb.AppendLine(LabelExtensions .Label(html, name, new { @class = String.Format("col-sm-{0} control-label", 12 - col_sm) }).ToHtmlString()); sb.AppendLine(String.Format("<div class=\"col-sm-{0}\">", col_sm)); sb.AppendLine("<div class=\"input-group\">"); sb.AppendLine(InputExtensions .Hidden(html, String .Format("MetaData[{0}].Type", num), meta.Type.ToString()).ToHtmlString()); switch (meta.Type) { case TypeOfMetaProduct.Author: case TypeOfMetaProduct.Country: case TypeOfMetaProduct.Director: case TypeOfMetaProduct.FromURI: case TypeOfMetaProduct.Genre: case TypeOfMetaProduct.InRole: case TypeOfMetaProduct.Name: case TypeOfMetaProduct.PosterFromURI: case TypeOfMetaProduct.Type: case TypeOfMetaProduct.View: case TypeOfMetaProduct.NumberOfEpisode: sb.AppendLine(InputExtensions .TextBox(html, String .Format("MetaData[{0}].String", num), meta.String, new { @class = "form-control" }).ToHtmlString()); break; case TypeOfMetaProduct.Begin: case TypeOfMetaProduct.End: sb.AppendLine(InputExtensions .TextBox(html, String .Format("MetaData[{0}].DateTime", num), meta.Date.ToShortDateString(), new { @class = "form-control" }).ToHtmlString()); break; case TypeOfMetaProduct.Ended: sb.AppendLine(InputExtensions .CheckBox(html, String .Format("MetaData[{0}].Bool", num), meta.Bool, new { @class = "form-control" }).ToHtmlString()); break; } sb.AppendLine("<span class=\"input-group-btn\">"); sb.AppendLine(String.Format( "<input name =\"MetaData[{0}].String\" type=\"submit\" value=\"Удалить\" class=\"btn btn-success\">", num)); sb.AppendLine("</span>"); sb.AppendLine("</div>"); sb.AppendLine("</div>"); sb.AppendLine("</div>"); return(new MvcHtmlString(sb.ToString())); }
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value = null, string cssClass = null, string dir = null, bool disabled = false, string id = null, string lang = null, int?maxLength = null, bool readOnly = false, int?size = null, string style = null, int?tabIndex = null, string title = null) { return(InputExtensions.TextBox( htmlHelper, name, value, InputAttributes(cssClass, dir, disabled, id, lang, maxLength, readOnly, size, style, tabIndex, title) )); }
public static MvcHtmlString TextBoxFor <TModel, TProperty> (this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression) { string format = (string)null; return(InputExtensions .TextBoxFor <TModel, TProperty>(htmlHelper, expression, format)); }
/// <summary> /// Returns an HTML5 numeric input element. /// </summary> /// <typeparam name="TModel">The type of the model.</typeparam> /// <typeparam name="TProperty">The type of the value.</typeparam> /// <param name="htmlHelper">The HTML helper instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <returns>An HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression.</returns> public static MvcHtmlString NumericTextBoxFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes, bool readoOnly = false) { RouteValueDictionary attributes = ReadOnlyAttribute(htmlAttributes, readoOnly); attributes.Add("type", "number"); attributes.Add("step", "any"); return(InputExtensions.TextBoxFor(htmlHelper, expression, attributes)); }
public static MvcHtmlString BootstrapRadioButtonFor <TModel>( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, bool> > expression, string text, string title, bool isAutoFocus, bool useInline, object htmlAttributes = null) { var sb = new StringBuilder(512); RouteValueDictionary rvd; rvd = new RouteValueDictionary( HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); if (string.IsNullOrWhiteSpace(title)) { title = text; } rvd.Add("title", title); if (isAutoFocus) { rvd.Add("autofocus", "autofocus"); } // Open the RadioButton element if (useInline) { sb.Append("<label class='radio-inline'>"); } else { sb.Append("<div class='radio'>"); sb.Append("<label>"); } // Build the RadioButton using InputExtensions class sb.Append(InputExtensions.RadioButtonFor( htmlHelper, expression, rvd)); // Add the Text sb.Append(text); // Close the RadioButton element if (useInline) { sb.Append("</label>"); } else { sb.Append("</label>"); sb.Append("</div>"); } return(MvcHtmlString.Create(sb.ToString())); }
public static MvcHtmlString ZN_PasswordFor <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, object htmlAttributes = null) { TagBuilder tagResult = new TagBuilder("div"); tagResult.MergeAttribute("class", "form-group"); tagResult.InnerHtml += LabelExtensions.LabelFor(htmlHelper, expression).ToHtmlString(); tagResult.InnerHtml += InputExtensions.PasswordFor(htmlHelper, expression, htmlAttributes).ToHtmlString(); tagResult.InnerHtml += ValidationExtensions.ValidationMessageFor(htmlHelper, expression, "", new { @class = "error" }).ToHtmlString(); return(tagResult.ToHtml()); }
public static MvcHtmlString JQM_CheckBoxFor <TModel>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, bool> > expression, FlipswitchConfig config) { TagBuilder tagResult = new TagBuilder("div"); tagResult.MergeAttribute("class", "ui-field-contain"); config.Configuration.Add("data-role", "flipswitch"); tagResult.InnerHtml += InputExtensions.CheckBoxFor <TModel>(htmlHelper, expression, config.GetAttributes()).ToHtmlString(); tagResult.InnerHtml += ValidationExtensions.ValidationMessageFor(htmlHelper, expression).ToHtmlString(); return(tagResult.ToHtml()); }
/// <summary> /// The Google map for the appropriate expression. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <param name="htmlHelper">The Html helper</param> /// <param name="expression">The expression</param> /// <param name="htmlAttributes">The html attributes</param> /// <returns>The Google map</returns> public static MvcHtmlString GoogleMapFor <T, U>(this HtmlHelper <T> htmlHelper, Expression <Func <T, U> > expression, object htmlAttributes = null) { ModelMetadata metadata = ModelMetadata.FromLambdaExpression(expression, htmlHelper.ViewData); string gps = metadata.Model == null ? DEFAULT_COORDINATES : metadata.Model.ToString(); StringBuilder sb = new StringBuilder(); sb.Append(string.Format(@"<div id='map-canvas' {0}></div>", HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes))); sb.Append(InputExtensions.Hidden(htmlHelper, metadata.PropertyName, gps)); return(MvcHtmlString.Create(sb.ToString())); }
/// <summary> /// Creates the editable label with the date picker. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <param name="htmlHelper">The html helper</param> /// <param name="expression">The expression with the date</param> /// <param name="htmlAttributes">The hml attributes</param> /// <returns>Returns the editable label with date picker</returns> public static MvcHtmlString DateFor <T, U>(this HtmlHelper <T> htmlHelper, Expression <Func <T, U> > expression, object htmlAttributes = null) { StringBuilder sb = new StringBuilder(); sb.Append(@"<div class='input-group date'>"); sb.Append(InputExtensions.TextBoxFor(htmlHelper, expression, "{0:dd.MM.yyyy}", new { @class = "form-control", @data_provide = "datepicker", @data_date_today_highlight = "true", @data_date_format = "dd.mm.yyyy" })); sb.Append(@"<span class='input-group-addon'><i class='fa fa-calendar'></i></span>"); sb.Append(@"</div>"); return(MvcHtmlString.Create(sb.ToString())); }
public static MvcHtmlString TextControlFor <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression, IDictionary <string, object> inputHtmlAttributes) { var metaData = ModelMetadata.FromLambdaExpression(expression, html.ViewData); var htmlFieldName = ExpressionHelper.GetExpressionText(expression); return(ControlGroupExtension.Helper( html, metaData, htmlFieldName, InputExtensions.TextBoxFor(html, expression, inputHtmlAttributes))); }
public static MvcHtmlString EncodedHidden(this HtmlHelper htmlHelper, string name, object value) { if (value == null) { return(MvcHtmlString.Empty); } var encoded = StringEncoderHelper.GetEncodedString(value); return(InputExtensions.Hidden(htmlHelper, SecurityHiddenFieldNamePrefix + name, encoded)); }
/// <summary> /// Creates the editable date picker range. /// </summary> /// <typeparam name="T"></typeparam> /// <typeparam name="U"></typeparam> /// <typeparam name="V"></typeparam> /// <param name="htmlHelper">The html helper</param> /// <param name="expressionFrom">The expression from date</param> /// <param name="expressionTo">The expression to date</param> /// <param name="htmlAttributes">The html attributes</param> /// <returns>Returns the date range picker</returns> public static MvcHtmlString DateRangeFor <T, U, V>(this HtmlHelper <T> htmlHelper, Expression <Func <T, U> > expressionFrom, Expression <Func <T, V> > expressionTo, object htmlAttributes = null) { StringBuilder sb = new StringBuilder(); sb.Append(@"<div class='input-group input-daterange' data-provide='datepicker' data-date-today-highlight='true' data-date-format='dd.mm.yyyy'>"); sb.Append(InputExtensions.TextBoxFor(htmlHelper, expressionFrom, "{0:dd.MM.yyyy}", new { @class = "form-control" })); sb.Append(@"<span class='input-group-addon'>-</span>"); sb.Append(InputExtensions.TextBoxFor(htmlHelper, expressionTo, "{0:dd.MM.yyyy}", new { @class = "form-control" })); sb.Append(@"</div>"); return(MvcHtmlString.Create(sb.ToString())); }
/// <summary> /// Bootstrap and HTML 5 Text Box Helper /// </summary> /// <param name="htmlHelper">The HTML helper instance that this method extends.</param> /// <param name="expression">An expression that identifies the object that contains the properties to render.</param> /// <param name="type">The text type to set (text, password, date, tel, email, etc.).</param> /// <param name="title">The HTML 5 'title' attribute to set.</param> /// <param name="placeholder">The HTML 5 'placeholder' attribute to set.</param> /// <param name="isRequired">Whether or not to set the 'required' attribute on this text box.</param> /// <param name="isAutoFocus">Whether or not to set the 'autofocus' attribute on this text box.</param> /// <param name="isDisable">Whether or not to set the 'disable' attribute on this text box.</param> /// <param name="htmlAttributes">An object that contains the HTML attributes to set for the element.</param> /// <returns>An HTML input element with the appropriate type set.</returns> public static MvcHtmlString TextBox5For <TModel, TValue>( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, Html5InputTypes type, string title, string placeholder, bool isRequired, bool isAutoFocus, bool isDisable, object htmlAttributes = null) { MvcHtmlString html = default(MvcHtmlString); Dictionary <string, object> attr = new Dictionary <string, object>(); if (htmlAttributes != null) { var attributes = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); foreach (var item in attributes) { attr.Add(item.Key, item.Value); } } attr.Add("type", type.ToString()); attr.Add("class", "form-control"); if (!string.IsNullOrEmpty(title)) { attr.Add("title", title); } if (!string.IsNullOrEmpty(placeholder)) { attr.Add("placeholder", placeholder); } if (isAutoFocus) { attr.Add("autofocus", "autofocus"); } if (isRequired) { attr.Add("required", "required"); } if (isDisable) { attr.Add("disabled", ""); } html = InputExtensions.TextBoxFor(htmlHelper, expression, attr); return(html); }
public static MvcHtmlString BoostrapTextBoxFor <TModel, TValue>( this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, HtmlExtensionsCommon.Html5InputTypes inputType, string title, string placeholder, bool isRequired, bool isAutoFocus, string cssClass = "", object htmlAttributes = null ) { RouteValueDictionary rvd; rvd = new RouteValueDictionary( HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); rvd.Add("type", inputType.ToString()); if (!string.IsNullOrEmpty(title)) { rvd.Add("title", title); } if (!string.IsNullOrEmpty(placeholder)) { rvd.Add("placeholder", placeholder); } if (isRequired) { rvd.Add("required", "required"); } if (isAutoFocus) { rvd.Add("autofocus", "autofocus"); } if (!string.IsNullOrEmpty(cssClass)) { cssClass = "form-control"; } else { cssClass = "form-control" + cssClass; } rvd.Add("class", cssClass); return(InputExtensions.TextBoxFor(htmlHelper, expression, rvd)); }
private void Update() { rightJoystick_ = new Vector2(Input.GetAxis("RStickHorizontal"), Input.GetAxis("RStickVertical")); leftJoystick_ = new Vector2(Input.GetAxis("LStickHorizontal"), Input.GetAxis("LStickVertical")); if (InputExtensions.AxisToButtonDown("RightTrigger")) { shieldManager_.NextShield(); } if (InputExtensions.AxisToButtonDown("LeftTrigger")) { shieldManager_.PrevShield(); } if (Input.GetButtonDown(throwButton_)) { shieldThrow_.Throw(); } if (Input.GetButtonDown(bashButton_)) { shieldBash_.Bash(); } if (InputExtensions.AxisToButtonDownInt("DPadVertical") < 0) { shieldThrow_.ReturnShields(); } if (leftJoystick_.magnitude > 0) { shieldWheel_.ActivateWheel(true); } else { shieldWheel_.ActivateWheel(false); } //Reload scene if (Input.GetButtonDown("StartButton")) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); } //Exit game if (Input.GetButtonDown("SelectButton")) { Application.Quit(); } }
public static MvcHtmlString HiddenForNew <TModel, TProperty>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > expression, string editorName, IDictionary <string, object> htmlAttributes = null) { if (htmlAttributes == null) { htmlAttributes = new Dictionary <string, object>(); } if (!htmlAttributes.ContainsKey("id")) { htmlAttributes.Add("id", editorName); } return(InputExtensions.HiddenFor(htmlHelper, expression, htmlAttributes)); }