从 C# 背后的代码访问 HTML 控件

发布于 2025-01-06 18:24:30 字数 171 浏览 4 评论 0原文

我的网页使用 jQuery 动态生成大量 HTML 来显示数据。但是,我需要从 C# 访问这些动态 HTML 控件。我无法执行 runat="server",因为 JQUERY 在运行时发挥其魔力,具体取决于用户的选择。

有什么方法可以从代码隐藏中访问这些动态创建的控件的 HTML 吗?

谢谢!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2025-01-13 18:24:30

如果您需要的只是输入字段(输入、选择、单选、复选框)中的值,只需确保 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"].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文