c# - How to serialize an object in MVC 5 Razor view -


i have tried follow this post in order create 3 page form wizard passes data each page.

he uses html helper serialize, serialize object in view.

@html.serialize("wizard", model) 

however html helper isn't available in mvc 5 seems.

i found related post here suggests using following serialize object.

@html.hidden("othercomplexdata", new microsoft.web.mvc.mvcserializer().serialize(complexobject)) 

but following error

there no argument given corresponds required formal parameter 'mode' of 'mvcserializer.serialize(object, serializationmode)'

it seems want serializationmode, documented 1 doesn't. https://msdn.microsoft.com/en-us/library/microsoft.web.mvc.mvcserializer.serialize(v=vs.118).aspx

what direction can go in now?

thanks.

here's serialization option need:

https://github.com/asp-net-mvc/asp.net-mvc-3/blob/master/mvc3/src/mvcfutures/mvc/serializationmode.cs

options signed or encryptedandsigned.

you can try , see if work.

there's multiple ways encode data work you. put values in hidden input using json.encode view, , json.decode on server side.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -