xml 到文本框

发布于 2024-11-15 17:36:58 字数 290 浏览 1 评论 0原文

我正在构建一个 Web 应用程序,我必须从配置文件中读取一些值,我假设该文件只是一个 XML 文件。因此,在此过程中,我可以使用“

XDocument config = XDocument.Load("\\path\to\example.exe.config");

现在我的网页中有一个文本框”来读取 XML 文档。我想在该文本框中获取特定值,用户可以在文本框中编辑和更新该值。

任何人都可以指导我找到解决方案吗?

使用 C#、Linq to XML、Asp.net

I am building a web application where I have to read some values from the config file which I am assuming as nothing but an XML file. So in this process I am able to read the XML document using

XDocument config = XDocument.Load("\\path\to\example.exe.config");

Now I have a textbox in my web page. I want to get a specific value into that textbox where the user can edit and update that value in the textbox.

Can any one guide me to the solution?

Using C#, Linq to XML, Asp.net

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风情万种。 2024-11-22 17:36:58

好吧,您有一个 XDocument,因此您可以使用 Linq to XML 来查询它的值。渲染页面时将其放入文本框中。当然,当您 POST 该值时,您必须再次加载该文件,再次查询 XDocument,然后在保存之前使用新值更新 XML 元素。

Well you have an XDocument, so you can use Linq to XML to query it for the value. Put that in the textbox when the page is rendered. Of course when you POST the value you'll have to load the file a second time, query the XDocument again, and then update the XML element with the new value before saving.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文