如何在代码隐藏中检索动态创建的控件的值?
我打算使用Javascript在每次用户单击“添加更多”按钮时动态创建一组html元素(输入框、选择列表、单选按钮等)。
我在这里找到了执行此操作的Javascript:
- http://viralpatel.net/blogs/2009/01/dynamic-add-textbox-input-button-radio-element-html-javascript.html
- http://forums.asp.net/p/1611284/4118564.aspx
那么我如何获取的值这些从代码隐藏动态创建的 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:
- http://viralpatel.net/blogs/2009/01/dynamic-add-textbox-input-button-radio-element-html-javascript.html
- http://forums.asp.net/p/1611284/4118564.aspx
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您可以通过回调/异步回发到 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.