示例#1
0
 /// <summary>
 /// Привязывает грид к модели данных и создает html.
 /// </summary>
 /// <param name="extension">Грид.</param>
 /// <param name="model">Созданная модель данных</param>
 public static MvcHtmlString BindToModel <TGridModel>(this GridViewExtension extension, GridModelBase model, HtmlHelper <TGridModel> html)
     where TGridModel : GridModelBase
 {
     if (html.ViewData["EditError"] != null)
     {
         extension.SetEditErrorText((string)html.ViewData["EditError"]);
     }
     return(extension.BindToLINQ(string.Empty, string.Empty, (s, e) => {
         e.QueryableSource = model.Model;
         e.KeyExpression = model.KeyFieldName;
     }).GetHtml());
 }