简体   繁体   中英

Handling elements generated by Javascript in Asp.Net

I have several elements in my web page generated by 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? (Since the elements were dynamically generated they do not exist in the original asp.net page)

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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