Access HTML controls from code behind C#

旧巷老猫 提交于 2020-01-06 05:49:06

问题


My webpage generates a lot of HTML dynamically using jQuery to display data. However, I need to access those dynamic HTML controls from C#. I cannot do runat="server", because JQUERY does its magic at runtime, depending on what user selects.

Is there any way to access the HTML of these dynamically created controls from code behind?

Thanks!


回答1:


If all you need are values from input fields (input, select, radio, checkbox), just make sure JQuery creates those inside the main <form> tag, then you can read them in the server side, after the form is submitted, using Request.Form["myFieldName"].



来源:https://stackoverflow.com/questions/9337418/access-html-controls-from-code-behind-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!