Create GridView in asp.net MVC3.0

后端 未结 4 395
慢半拍i
慢半拍i 2020-12-28 09:36

Is it possible to create grid in asp.net MVc3.0. The gridview that is used in asp.net similar to that if yes then please let me know how to create a simple grid in asp.net m

相关标签:
4条回答
  • 2020-12-28 10:03

    See the excellent Get the Most Out of WebGrid in ASP.NET MVC

    0 讨论(0)
  • 2020-12-28 10:11

    There are different possibilities:

    Server side grids:

    • The built-in WebGrid helper
    • MvcContrib Grid
    • Telerik Grid

    Client-Side grids:

    • jqGrid
    • YUI DataTable

    and many others...

    0 讨论(0)
  • 2020-12-28 10:15

    You need to create it using TABLE / TR / TD tags.

    Here is few links which may help you

    1. mvc gridview with code
    2. http://www.schnieds.com/2010/01/gridview-in-aspnet-mvc.html
    0 讨论(0)
  • 2020-12-28 10:19

    You can use WebGrid in MVC3. This is new in MVC3. Use this code in your View.

    @model IList<YourViewModel>
    @{
        ViewBag.Title = "Amend Absence";
        Layout = "~/Views/Shared/_Layout.cshtml";
    }
    @{
        var grid = new WebGrid(source: Model, rowsPerPage: 200, 
        canPage: false, canSort: true, defaultSort: "Absentee");
     }
    <p>
        <h2>Absentee List</h2>
            <div id="grid">
                @grid.GetHtml(
                    tableStyle: "grid",
                    headerStyle: "head",
                    alternatingRowStyle: "alt",
                    columns: grid.Columns(
                    grid.Column(format: (item) => Html.ActionLink("Edit", "Edit", 
                    new { id =   item.Id     })), 
                    grid.Column("Absentee", "Absentee",canSort:true),
                    grid.Column("AbsStart", "AbsStartDate")
                ))
          </div>
      </p>
    
    0 讨论(0)
提交回复
热议问题