c# - Grid.MVC Single view for CRUD operations -
I am using Grid.MVC () and I want to render a grid and CRUD for the grid in the same view Need for
@Electrical IEnumerable & lt; Grid.Models.Catagory & gt; ... ... @ Html.Grid (model) .Columns (columns => {columns.Add (). Encoded (wrong) .Sanitized (incorrect) .Titled ("CatagoryName") RenderValueAs (o = & gt; RenderCatagoryName ("CatagoryName", o.CatagoryName); columnss.Add () .Encoded (wrong) .Sanitized (incorrect) .Titled ("Color") RenderValueAs (o = & gt; RenderCatagoryName ("Color", o .color)); columns.Add () .Encoded (false) .Sinitized (false) .titled ("print template") RenderValueAs (o = & gt; RenderCatagoryName ("print template", o.PintTemplate));} My Controller
Public ActionResult Index () {Return View (Customers);} This, OK Works, but when I need to put one in the same scene I am unable to use the same model because it is an IEnumerable type.
- could not use the instet value - // model Irectly for D because it is a list type Is @ Html.LabelFor (M => M) @ Html.TextBoxFor (M = & gt; m, new {maxlength = 50}) My ViewModel
public class category {public interagorid {received; Set; } Public String CatagoryName {get; Set; } Public string color {get; Set; } Public String PrintTemplate {get; Set; } Public string language {get; Set; }} what grid There is no way to use the same view for both MVC and insert operation
View: class / <> Make a list of codes (the spelling 'category' of BTD) is the property of a new visual model.
Public class MyViewModel {Access to the public category category {receive; set;} public IEnumerable & lt; Category & gt; Categories {Get Satisfaction; Set;}}
@ Model MyViewModel ... ... @ Html.Grid (Model.Categories) column (Columns = & gt; ... @ * Include Form: * @ @ html.LabelFor (m = & gt; m.CategoryToInsert.CategoryName) @HTML TextboxPhore (M => M. CarregisterTechnet.CantonName, New {Maxlength = 50})
Comments
Post a Comment