【发布时间】:2011-06-02 17:58:29
【问题描述】:
我被分配到某个项目的 web 部分。这个项目有两个部分, 窗口和网页。在窗口部分,用户可以创建自己的自定义模板 像visual studio IDE一样,你可以添加表单和其他控件。然后,我们保存这个模板 使用 xml 文件中的数据。我的职责是从此 xml 文件中读取并创建 web 表单。 对于 Web 部件,仅显示从窗口部件创建的信息。 我们的xml文件格式如下。对于web部分,我们用c#.net用asp.net mvc开发。
<Object type="System.Windows.Forms.Form">
<Object type="System.Windows.Forms.Label">
<Property name="Name">lblCity</Property>
<Property name="Text">City</Property>
</Object>
<Object type="System.Windows.Forms.TextBox">
<Property name="Name">txtCity</Property>
<Property name="Text">England</Property>
</Object>
<Object type="System.Windows.Forms.Label">
<Property name="Name">lblNRIC</Property>
<Property name="Text">NRIC</Property>
</Object>
<Object type="System.Windows.Forms.TextBox">
<Property name="Name">txtNRIC</Property>
<Property name="Text">ABC01234</Property>
</Object>
<Object type="System.Windows.Forms.RadioButton">
<Property name="Name">RadioButton1</Property>
<Property name="Text">OptionA</Property>
</Object>
<Object type="System.Windows.Forms.CheckBox">
<Property name="Name">CheckBox1</Property>
<Property name="Text">Yes</Property>
</Object>
<Object type="System.Windows.Forms.CheckBox">
<Property name="Name">CheckBox2</Property>
<Property name="Text">No</Property>
</Object>
<SampleDataSet>
<SampleTable>
<TableName>Sample1</TableName>
<ProductName>ABC</ProductName>
<Price>100</Price>
<Qty>10</Qty>
<Amount>1000</Amount>
</SampleTable>
<SampleTable>
<TableName>Sample2</TableName>
<ProductName>DEF</ProductName>
<Price>200</Price>
<Qty>20</Qty>
<Amount>4000</Amount>
</SampleTable>
<SampleTable>
<TableName>Sample3</TableName>
<ProductName>GHK</ProductName>
<Price>300</Price>
<Qty>30</Qty>
<Amount>9000</Amount>
</SampleTable>
</SampleDataSet>
</Object>
我们知道它不应该像窗口部分那样创建 web 表单,但是,我们真的需要它。 那么,我如何解决我的问题?我可以使用 xml 序列化吗? 请用一些例子给我正确的方法。
问候
韩
【问题讨论】:
标签: asp.net asp.net-mvc