/// <summary>
        /// Create the text-box and hidden field that is also has validation hooked up
        /// </summary>
        /// <typeparam name="TModel">The model</typeparam>
        /// <typeparam name="TProperty">The property to display in the text-box</typeparam>
        /// <typeparam name="TKey">The id in the hidden field</typeparam>
        /// <param name="htmlHelper">The helper</param>
        /// <param name="nameExpression">The expression for the string in the text-box</param>
        /// <param name="hiddenFor">The expression for the hidden field id</param>
        /// <returns></returns>
        public static MvcHtmlString AutoCompleteFor <TModel, TProperty, TKey>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > nameExpression, Expression <Func <TModel, TKey> > hiddenFor)
        {
            var textbox     = BootstrapTextBoxHelper.BootstrapTextBoxFor(htmlHelper, nameExpression).ToHtmlString();
            var hiddenField = HtmlHiddenHelperFor.CleanHiddenFor(htmlHelper, hiddenFor).ToHtmlString();

            return(new MvcHtmlString(string.Format("{0} {1}", textbox, hiddenField)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create the text-box and hidden field that is also has validation hooked up
        /// </summary>
        /// <typeparam name="TModel">The model</typeparam>
        /// <typeparam name="TProperty">The property to display in the text-box</typeparam>
        /// <typeparam name="TKey">The id in the hidden field</typeparam>
        /// <param name="htmlHelper">The helper</param>
        /// <param name="nameExpression">The expression for the string in the text-box</param>
        /// <param name="hiddenFor">The expression for the hidden field id</param>
        /// <returns></returns>
        public static IHtmlContent AutoCompleteFor <TModel, TProperty, TKey>(this IHtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TProperty> > nameExpression, Expression <Func <TModel, TKey> > hiddenFor)
        {
            var textbox     = Utils.GetString(BootstrapTextBoxHelper.BootstrapTextBoxFor(htmlHelper, nameExpression));
            var hiddenField = Utils.GetString(HtmlHiddenHelperFor.CleanHiddenFor(htmlHelper, hiddenFor));

            return(new HtmlString(string.Format("{0} {1}", textbox, hiddenField)));
        }