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.

4

1 回答 1

1

您必须在 javascript 中执行此操作。如果您使用像 jquery 这样的库,事情会容易得多。

处理表单提交事件。在其中,您基本上必须对 http 表单进行序列化。下面的帖子会给你一个想法:https ://stackoverflow.com/a/2088897/145682

该链接讨论了使用名为 json2xml 的特定插件

但是你对文件上传做了什么?!

那么有解决方法:

  1. 您可以尝试基于 iframe 的文件上传(用于处理旧浏览器),或者,
  2. 使用 HTML5 和 Ajax 的异步文件上传
于 2014-04-02T12:37:39.267 回答