asp.net mvc 4 - Why httpGet action method not display the data into view in mvc 4? -


my problem view model,when pass values http action to http post action through view, view method not display values directly showing http post action without display view method why not displaying view?

[httpget] public actionresult index() {   return view(); } 

view model

public class sample {   [key]   public int id { get; set; }   public string name{ get; set; }  } 

view

@using (html.beginform()) {   @html.textboxfor(m=>m.name);   <input type="submit" value="index"/> } 

post method

[httppost] public actionresult index(string name) {   return view(); } 

i think not using httppost method correctly. should doing way:

[httppost] public actionresult index(sample model) {   return view(model); } 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -