0

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.

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

2 Comments

There are multiple way of doing this. I want best approach
This is it. You have a whole js plugin dedicated to the task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.