为什么在按钮单击中丢失了网格中的动态创建控件? [英] Why dynamic created control in grid is lost in button click?
本文介绍了为什么在按钮单击中丢失了网格中的动态创建控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在网格中创建了动态控件(TextBox),但是无法使用控件ID(FindControl)在按钮单击中找到控件。
我尝试了什么:
我在网格中创建动态控件(TextBox)bt无法使用控件ID(FindControl)找到按钮单击控件。
解决方案
因为按钮单击会启动回发(全部或部分),您必须在回发时重新创建这些动态控件,否则它们将丢失(因为它们不是标准创建链的一部分) )...
I created dynamic control(TextBox) in grid bt cant find that control in button click using control id(FindControl).
What I have tried:
I created dynamic control(TextBox) in grid bt cant find that control in button click using control id(FindControl).
解决方案
Because button click initiates a postback (full or partial) and you have to recreate those dynamic controls upon postback, otherwise they will be lost (as they are not part of the standard creation chain)...
这篇关于为什么在按钮单击中丢失了网格中的动态创建控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文