开发者

How to update database from WebGrid in Asp.net MVC3

I want to edit my webgrid values and updated values save in database.

how can i do that using repository pattern.

supppose i have two columns in my WebGrid

开发者_开发问答

Item Amount

A 0 (textbox)

B 0 (textbox)

C 0 (textbox)

Above values are displayed from database.

Now i want to edit amount column and want to save that in database.

any idea?

code in view for display values from database

@{
    var grid = new WebGrid(Model, columnNames: new[] { "ItemName", "Amount" });
 }

    @grid.GetHtml(columns: grid.Columns(grid.Column("ItemName", header: "Item Name"),
    grid.Column("Amount", header: "Amount", format: @<text><input name="Amount" type="text" value="@item.Amount" /></text>))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜