从后面的C#code使用HTML控件 [英] Access HTML controls from code behind C#
问题描述
我的网页上生成大量的HTML动态地使用jQuery来显示数据。但是,我需要从C#访问这些动态HTML控件。我做不到=服务器,因为jQuery做它的魔力在运行时,取决于选择什么样的用户。
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.
有没有办法从code访问这些背后动态创建控件的HTML?
Is there any way to access the HTML of these dynamically created controls from code behind?
谢谢!
推荐答案
如果你需要的是从输入字段(输入,选择,单选,多选)值,只要确保JQuery的创建与主<形式>
标记,那么您可以在服务器端阅读,提交表单后,使用的Request.Form [myFieldName]
。
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"]
.
这篇关于从后面的C#code使用HTML控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!