title: how to custom a webgrid template or similar function in mvc3!
body: <p><strong>webgrid is Easy to use ,in mvc3 but the parameter is too many， each page need to set the parameter is so so terrible,
  Is there any way to fixed a few parameter in Templates , for example to fix :</strong></p>
  
  <pre><code>                  tableStyle: "webgrid-table"
                   , headerStyle: "webgrid-header"
                   , alternatingRowStyle: "alt"
                   , selectedRowStyle: ""
                   , displayHeader: true
                   , numericLinksCount: 10
                   , footerStyle: "paging-number"
                   , rowStyle: "webgrid-row"
  </code></pre>
  
  <p><strong>and common columns  delete,add,edit</strong></p>
  
  <p>grid.Column(format: (item) => Html.ActionLink(" "
                         , "add"
                           , null
                          , new { @class = "webgrid-add", title = " add row", onclick = "return gridop(this);" }))
                       , grid.Column(format: (item) => Html.ActionLink(" "
                            , "edit"
                              , null
                                , new { id = item[0]}
                                , new { @class = "webgrid-edit", title = "edit row", onclick = "return gridop(this);" }))
                       , grid.Column(format: (item) => Html.ActionLink(" "
                                     , "del"
                                   , null
                                      , new { id = item[0]}
                                       , new { @class = "webgrid-del", title = " delete row", onclick = "return gridop(this);" }))</p>
  
  <p><strong>If completed before the code，When we are ready to show webgrid， only to coding " showgrid(Model); " in page;</strong></p>
  
  <hr>
  
  <p>gridmodel.cshtml</p>
  
  <p>@model IEnumerable
  @{
   var grid = new WebGrid(Model,rowsPerPage:10);</p>
  
  <pre><code>if (ViewData.TemplateInfo.TemplateDepth &gt; 1)
  {
  @ViewData.ModelMetadata.SimpleDisplayText;
  }
  else
  {
  
      List&lt;WebGridColumn&gt; columns = new List&lt;WebGridColumn&gt;();
      columns.Add(grid.Column(format: (item) =&gt; Html.ActionLink(" "
                     , "add"
                      , null
                      , new { @class = "webgrid-add", title = " 添加新记录！", onclick = "return gridop(this);" })));
  
      columns.Add(grid.Column(format: (item) =&gt; Html.ActionLink(" "
                            , "edit"
                            , null
                           , new { @class = "webgrid-edit", title = " 编辑本行记录信息！", onclick = "return gridop(this);" })));
      columns.Add(grid.Column(format: (item) =&gt; Html.ActionLink(" "
                             , "del"
                              , null
                               , new {id = item[1] }
                                 , new { @class = "webgrid-del", title = " 删除本行记录信息！", onclick = "return gridop(this);" })));                                                                    
  
  
  
                     if (ViewData.TemplateInfo.TemplateDepth &gt; 1)
  {
  @ViewData.ModelMetadata.SimpleDisplayText;
  }
                     else
                     {
  
                         foreach (var item in ViewData.ModelMetadata.Properties.Where(pm =&gt; pm.ShowForEdit &amp;&amp;
                                                                                                        !ViewData.TemplateInfo.Visited(pm)))
                         {
  
                             if (!item.HideSurroundingHtml)
                             {
                                 columns.add(new WebGridColumn { ColumnName = item.PropertyName, Header = item.DisplayName });
                             }
  
                         }
                     }
  
      var a = grid.GetHtml(tableStyle: "webgrid-table"
                   , headerStyle: "webgrid-header"
                   , alternatingRowStyle: "alt"
                   , selectedRowStyle: ""
                   , displayHeader: true
                   , caption: "aaaaaaaaaaaaaaaa"
                   , numericLinksCount: 10
                   , footerStyle: "paging-number"
                   , rowStyle: "webgrid-row"
                   , columns: grid.Columns(columns.ToArray()
  
  
                 )
                 );
  
    @Html.Raw(a.ToString());
             }
  
  }
  </code></pre>
  
  <p><strong>over is my code ,but ViewData.ModelMetadata.Properties is null, can't to retrieve item.PropertyName,
   item.DisplayName . I do not know why！
  Please help me !</strong> </p>