如何创建一个Web表单应用程序,允许上载由WPF应用程序创建的XML文档并以一种很好的方式显示内容。 [英] How do I create a web forms application that allows for uploading of the XML document created by the WPF application and displays the content in a nice way.
本文介绍了如何创建一个Web表单应用程序,允许上载由WPF应用程序创建的XML文档并以一种很好的方式显示内容。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我需要一些帮助。
我创建了wpf表单并填充了xml文档。我已经创建了Web表单,但我不知道该怎么回答问题。
有人帮助创建按钮的代码并上传xml创建并以表格形式显示其内容。
以表格形式显示上传的xml的内容,或者更好地显示我需要的内容。
我尝试过:
这是按钮表单中的代码和文本框。
Hi members, I need some help here.
I have created the wpf form and it populates the xml document. I have created the web form but i don't know how to go about what the question is asking.
someone help the code of creating a button and that uploads the xml created and display its content in table form.
Displaying the content of the uploaded xml in table form or rather in a nice way is what i need.
What I have tried:
Here is the code in the form for button and textbox.
<form id="form1" runat="server">
<asp:FileUpload id="FileUploadControl" runat="server" />
<asp:Button runat="server" id="UploadButton" text="Upload" onclick="UploadButton_Click" />
<br /><br />
<asp:Label runat="server" id="StatusLabel" text="Upload status: " />
</form>
--------
And here is the code required to handle the upload..
<pre>protected void UploadButton_Click(object sender, EventArgs e)
{
if(FileUploadControl.HasFile)
{
try
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
}
catch(Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
推荐答案
XML已经是人类可读的形式。
为了很好地显示它,你可以简单地将它输出为字符串;每个结束标记后都有一个换行符。
还有别的东西,它变得复杂。
XML is already in "human readable" form.
In order to display it "nicely", you can simply output it as a "string"; with a line break after each ending tag.
Anything else, and it gets "complicated".
这篇关于如何创建一个Web表单应用程序,允许上载由WPF应用程序创建的XML文档并以一种很好的方式显示内容。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文