如何在代码隐藏中检索动态创建的控件的值?

发布于 2024-10-06 10:34:44 字数 558 浏览 1 评论 0原文

我打算使用Javascript在每次用户单击“添加更多”按钮时动态创建一组html元素(输入框、选择列表、单选按钮等)。

我在这里找到了执行此操作的Javascript:

那么我如何获取的值这些从代码隐藏动态创建的 HTML 元素?有没有更好的 JQuery 方法?

谢谢。

I intend to use Javascript to dynamically create a group of html elements (input boxes, select list, radio button, etc.) each time the user clicks "Add More" button.

I have found the Javascript that does that here:

So how do I get the values of these dynamically created HTML elements from code-behind? Is there a JQuery way which is better?

Thank you.

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

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

发布评论

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

评论(1

愛放△進行李 2024-10-13 10:34:44

我认为您可以通过回调/异步回发到 ASP.NET 页面来在更新时更新控制树。不确定 ViewState 如何受此更新/影响。

否则,因为您弄乱了 ViewState,所以您需要恢复通过 Request.Form 对象来访问它们。

I think you'd may be able to do it with a callback/async postback to your ASP.NET page to update the control tree as you update. Not sure how the ViewState is updated/affected by this.

Otherwise, because your messing with the ViewState, so you'll need to revert to accessing them by the Request.Form object.

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