English 中文(简体)
mvc 网络网格中的文本区域
原标题:TextArea in mvc web grid

我有一个网格视图,如何在文本区域显示字段“内容”的信息?

 @grid.GetHtml(  fillEmptyRows: false,
            mode: WebGridPagerModes.All,
            firstText: "<< First",
            previousText: "< previous",
            nextText: "Next >",
            lastText: "last >>",
            columns: new [] {
            grid.Column("NameInform", header: "Name"),
               .
               .
               .
               .
            grid.Column("Content", header: "Content"),
            grid.Column(
            "", 
            header: "  ",
            format: @<text>
                 @Html.ActionLink("Edit", "ModelosEdit", new { id = item.IdInform }) 
                |
                @Html.ActionLink("Delete", "Delete", new { id = item.IdInform })
              </text>    )})

祝福

最佳回答

您可以使用自定义格式, 就像您对最后一列所做的那样 :

grid.Column(
    "Content", 
    header: "Content", 
    format: 
        @<text>@Html.TextArea("Content", (string)item.Content)</text>
)
问题回答

暂无回答




相关问题
How to change the default sort order to descending?

How do I change the defaultSort of my webGrid to be in the opposite/descending order? If it were SQL, I d be adding a DESC somewhere. Here s my working line of code for an Ascending sort: var grid =...

MVC 3 Webgrid Column

I m working on a MVC 3 webgrid at the moment, in one of the columns I wish to have a button, I ve achieved this when putting the following code in the view. @grid.GetHtml(columns: grid....

How to hide header on MVC3 WebGrid

Is there some easy way to hide header for MVC3 WebGrid extension? Something like var grid = new WebGrid(Model, canSort:false, canPage:false, showHeader:false); I can probably set css style for ...

asp.net mvc 3 webgrid sorting remains ?sortdir=ASC

I m experimenting a bit with several grids in asp.net mvc. Microsoft has a grid too know in the prerelease of mvc 3 so I thought I ll try that one out. The basic functionality is quite easy to ...

How to make a MVC 3 Webgrid with checkbox column?

The code below will insert an actionlink into one of the web grids columns. @{ View.Title = "Index"; Layout = "~/Views/Shared/_Layout.cshtml"; var usersGrid = new WebGrid(source: ...

Mvc 3 texbox in webgrid (razor)

Simple Q:How do you I get the textbox to show the value. Code below fail on item.LastName @model List<Mvc2010_11_12.Models.Employee> @{ var grid = new WebGrid(source: Model,defaultSort: "...

ASP.NET MVC 3 WebGrid paging issue

My data access layer returns collection with rows for single page and total number of rows. Unfortunately WebGrid component does not allow to specify total number of rows or total number of pages (...

热门标签