控件访问值回发动态创建 [英] access values of controls dynamically created on postback

查看:114
本文介绍了控件访问值回发动态创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是:
我有一个表,动态创建的,用了很多dropdownlists女巫ID是动态创建的填写。

My problem is: I've got a table, dynamically created, fill with a lot of dropdownlists witches IDs are dynamically created.

当按钮被pressed,我需要扫描所有的控制表中,并保存自己的价值。

When a button is pressed, I need to scan all controls in the table and save their value.

不过,回传后,我无法再访问该表,我不知道我怎样才能得到这些值...

But after the postback I can't no longer access to the table, and I've no idea how can I get those values...

谢谢!

推荐答案

动态创建的,必须在对每一个事件的再次回发创建的控件初始化或preINIT(ViewState是加载之前),否则你将无法检索它们的值。

Controls created dynamically must be created again on every postback on the event Init or PreInit (before ViewState is loaded) otherwise you won't be able to retrieve their values.

一些参考链接

http://msdn.microsoft.com/en-us/库/ ms972976.aspx#viewstate_topic4

http://aspnet.4guysfromrolla.com/articles/081402-1.aspx

http://aspnet.4guysfromrolla.com/articles/082102-1.aspx

这篇关于控件访问值回发动态创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆