我如何从aspx页面以xml格式写入文件名? [英] how can i write a file name in xml from aspx page?

查看:73
本文介绍了我如何从aspx页面以xml格式写入文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过单击将图像文件名写在xm​​l文件的aspx页面中.

thnx

解决方案

您将图像放在哪个控件中?如果不是ImageButton,则不会发生OnClick事件.您将必须处理javascript中的单击,然后从那里调用服务器端方法.可以使用__DoPostBack或使用隐藏的字段和form.Submit来完成.

在该方法中,您可以从Image控件获取文件路径并将其保存到XML文件.要将数据保存到XML文件,可以使用LINQ2XML,XMLDocument或任何其他首选方式.


我认为您的问题似乎是有效的,但是您编写的方式确实如此令人困惑.您可以考虑为此使用Ajax.

简化Asp.Net Core Ajax


i want to write a image file name which is in aspx page in xml file by click on it.

thnx

解决方案

In which control do you have the image in? If it is not ImageButton, you will not have OnClick event. You will have to handle the click in javascript and then call a server side method from there. This can be done using __DoPostBack or by using a hidden field and form.Submit.

In that method, you can get the file path from the Image control and save it to the XML file. To save data to the XML file, you can make use of LINQ2XML, XMLDocument or any other preferred way.


I think your Problem seems to be valid, But the way you wrote made it so confusing. You can think of using Ajax for this.

Simplifying Asp.Net Core Ajax


这篇关于我如何从aspx页面以xml格式写入文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆