处理asp.net中的formview中的控件 [英] handles a control in a formview in asp.net

查看:285
本文介绍了处理asp.net中的formview中的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何从formview中包含的控件中处理一个句柄,仅在代码中我可以看到formview,而inserttemplate中没有这些控件.

How can I do a handles from a control contened in a formview, in code only i can see formview but not the controls in the inserttemplate.

感谢您的帮助

推荐答案

您必须使用FindControl方法来查找控件.

You have to use the FindControl method to find a control.

TextBox txtEmail = (TextBox)FormView1.FindControl("ControldID");

这是因为不能直接访问DataBound控件中的控件.要访问这些控件,必须使用FindControl方法并将其强制转换为适当的控件.

This is because the controls that are in the DataBound Controls are not directly accessible. To Access these controls, you have to use the FindControl method and cast it in appropriate control.

这篇关于处理asp.net中的formview中的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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