コード例 #1
0
        public static MvcHtmlString LabelMaskFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, object htmlAttributes = null)
        {
            MaskAttribute mask  = MaskAttribute.ExtractMaskAttribute <TModel, TValue>(expression);
            string        value = ExpressionHelper.GetExpressionText(expression);

            return(htmlHelper.LabelMask(ExpressionHelper.GetExpressionText(expression), value, mask, htmlAttributes));
        }
コード例 #2
0
        public static MvcHtmlString TextBoxMaskFor <TModel, TValue>(this HtmlHelper <TModel> htmlHelper, Expression <Func <TModel, TValue> > expression, object htmlAttributes = null)
        {
            MemberExpression memberExpression = expression.Body as MemberExpression;

            object[]      masks = memberExpression.Member.GetCustomAttributes(typeof(MaskAttribute), true);
            MaskAttribute mask  = MaskAttribute.ExtractMaskAttribute <TModel, TValue>(expression);

            string value = ExpressionHelper.GetExpressionText(expression);

            return(htmlHelper.TextBoxMask(ExpressionHelper.GetExpressionText(expression), value, mask.MaskTemplete, mask.FormatInRender, htmlAttributes));
        }
コード例 #3
0
        public static MvcHtmlString TextBoxMask <TModel>(this HtmlHelper <TModel> htmlHelper, string name, string value, Expression <Func <TModel, string> > maskExpression, object htmlAttributes = null)
        {
            MaskAttribute mask = MaskAttribute.ExtractMaskAttribute <TModel, string>(maskExpression);

            return(htmlHelper.TextBoxMask(name, value, mask.MaskTemplete, mask.FormatInRender, htmlAttributes));
        }