Jalpesh Vadgama
Jalpesh Vadgama

Reputation: 14266

Creating a xml from html form in asp.net mvc application

We are creating a ASP.NET MVC 4 application for a client where we need to create a xml from the HTML form in view and store it in the database.

So I want to know best approach for doing this? Does any one have an idea.

I want some thing like this.

Suppose A form has firstname and lastname textbox then when I save that form it will create a xml based on the form with firstname and lastname value.

Any help would be appreciated.

Upvotes: 0

Views: 671

Answers (1)

deostroll
deostroll

Reputation: 11995

You have to do this in javascript. Things are much easier if you use libraries like jquery.

Handle the the form submit event. In it you basically have to seralize the http form. The following post will give you an idea: https://stackoverflow.com/a/2088897/145682

The link talks about using a particular plugin called json2xml

But what do you do for file uploads?!

Well there are workarounds for that:

  1. You can try iframe based file upload (for dealing with old browsers), or,
  2. Asynchronous file uploads using HTML5 & Ajax

Upvotes: 1

Related Questions