无法检索动态生成的控件的值 [英] Cannot retrieve values of dynamically generated controls
问题描述
大家好,
我正在创建一个用户控件,其中包含需要在飞行中创建的复选框和标签。动态生成这些控件取决于从SPlist中检索的值。
I am creating a user control which contains checkboxes and labels that needs to be created on fly. The dynamic generation of these controls depend on the values retreived from a SPlist.
我有几个面板,根据选择标准显示从列表中查询的项目。在按钮单击事件中,我需要从动态生成的控件中捕获所有选定的值。
I have several panels that display items queried from the list on the basis of a selection criteria. On a button click event I need to capture all the selected values from the controls that were generated dynamically.
当我遍历我添加到面板的每个动态控件时,我看不到他们的价值观我尝试从页面中使用递归检索控件,但它只是表现得很疯狂,它将单选按钮视为一个复选框,并返回一个我不想要的
的值。我没有使用page_load()或任何其他事件,我在自定义方法上使用按钮处理程序。
When I traverse each dynamic control that I added to the panel, I dont see their values. I tried using recursive retrieval of the control from the page as well but it just behaves crazy, it treats a radio button as a checkbox and returns a value that I am not looking for. I am not using the the page_load() or any other event, I use the button handler on my custom method.
我正在考虑ViewState,ControlsState或SessionState。我假设ViewState可能无法正常工作,因为动态生成的控件需要在page_load事件中。请指导,因为这比我想象的更加复杂
它。
I was thinking for ViewState, ControlsState or SessionState. I assume ViewState may not work on this as the dynamically generated controls need to be in the page_load event. Please guide as this getting way more complicated than what I had ever thought of it to be.
推荐答案
anyuone是否有答案我的问题??
Does anyuone has an answer to my question??
这篇关于无法检索动态生成的控件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!