Exemple #1
0
 /// <summary>
 /// 根据模型定义查看表单
 /// </summary>
 /// <typeparam name="TModel"></typeparam>
 /// <param name="model"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public static FormHorizontalDefining <TModel> Define <TModel>(TModel model, ListDataSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     return(new FormHorizontalDefining <TModel>(model, null, source, false));
 }
Exemple #2
0
 /// <summary>
 /// 根据模型创建提交表单
 /// </summary>
 /// <typeparam name="TModel"></typeparam>
 /// <param name="model"></param>
 /// <param name="action"></param>
 /// <param name="source"></param>
 /// <returns></returns>
 public static FormHorizontal Create <TModel>(TModel model, ILocation action, ListDataSource source)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     return(new FormHorizontalDefining <TModel>(model, action, source, true).Create());
 }
        internal FormHorizontalDefining(TModel model, ILocation action, ListDataSource source, bool inputMode)
        {
            Model     = model;
            Action    = action;
            Source    = source;
            InputMode = inputMode;
            Items     = new Dictionary <PropertyInfo, ModelPropertyContent>();
            InitItems(typeof(TModel));

            Buttons      = new List <IHtmlElement>();
            ResetButton  = new HtmlElement(HtmlTag.Input).Attribute(HtmlAttribute.Type, "reset").AddClass("btn btn-default");
            SubmitButton = new HtmlElement(HtmlTag.Input).Attribute(HtmlAttribute.Type, "submit").AddClass("btn btn-primary");
        }