ASP.NET MVC: Using the same form for Add and Edit when specifying html attributes? -


i wish use same form adding , editing records within database using partial view. understand fine standard html.beginform automatically output correct html depending on action being used (add / edit). however, need out said form html attributes. there not appear overload allows happen without specifying action , controller names. if hardcode these surely cant use same form edit , add automatically?

or missing something?

cheers

set values of action , controller null , pulled context. if @ source overload doesn't require parameters, you'll see calls versions requiring more parameters these values null. calling overload directly null values have same effect. depending on overload you're using might need cast null values strings -- i'd if compiler not able differentiate methods without casting nulls strings.

<% using (html.beginform( null, null, formmethod.post, new { @class = "foo" } ))    { %> <% } % > 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -