简体   繁体   English

处理由Java在Asp.Net中生成的元素

[英]Handling elements generated by Javascript in Asp.Net

I have several elements in my web page generated by JavaScript. 我的网页中有一些由JavaScript生成的元素。 Here's an example of such content: 这是此类内容的示例:

<input id="uploadfile01" type="file" onchange="change(1);" />
<input id="uploadfile02" type="file" onchange="change(2);" />

My question is: How can I interact with these elements in the server side, (Asp.net) after a post? 我的问题是:发布后,如何与服务器端(Asp.net)中的这些元素进行交互? (Since the elements were dynamically generated they do not exist in the original asp.net page) (由于元素是动态生成的,因此它们在原始的asp.net页中不存在)

I dont think that would be possible.....if i am not mistaken you want to give the option to attach multiple files. 我不认为那是可能的.....如果我没记错的话,您想提供附加多个文件的选项。 i think it would be better to place a set number of fileupload controls and set there display to none and you can use javascript to show them. 我认为最好放置一定数量的fileupload控件并将那里的显示设置为none,并且可以使用javascript来显示它们。

i know that this is not what you are looking for but after a postback the controls will be lost and even if they are added again they will lose there contents.(had you been generating them through code behind) 我知道这不是您要查找的内容,但是回发后,控件将丢失,即使再次添加它们也将丢失那里的内容。(如果您通过背后的代码生成它们)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM