c# - Razor Hidden multiple properties -


suppose have object obj of type mytipe properties: prop1, prop2....prop1 , next razor view

@model mytipe @using(html.beginform()) {  @html.textboxfor(m => m.prop1)   @html.hiddenfor(m => m.prop2)  @html.hiddenfor(m => m.prop3) ..............  @html.hidenfor(m => m.propn) <input type="submit/> } 

there posibility replace hiddenfor lines samethink else

you can wrap properties, should hidden in 1 object e.g.:

public class someviewmodel {     public hiddenmodel hide{get; set;}     ...     // other properties }  public class hiddenmodel {     public int prop1 {get; set;}     public string prop2 {get; set;} } 

and in view:

@model someviewmodel @using(html.beginform()) {     @html.textboxfor(m => m.prop1)      @html.hiddenfor(m => m.hide)     <input type="submit/> } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -