是什么以及如何使用e.row.findcontrol [英] What is and how to use e.row.findcontrol

查看:152
本文介绍了是什么以及如何使用e.row.findcontrol的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释使用e.row.findcontrol ???

解决方案

它用于查找容器内的特定控件。例如,如果在gridview中有一个标签(在每一行中),现在你想在运行时设置它的文本(根据条件),然后在gridview的RowDataBound事件中你将检查条件如果该条件匹配,您将找到标签来设置它的文本。为此你将使用e.Row.FindControl(yourLabelID)并将其作为标签投射。



标签lbl =(标签)e.Row.FindControl(  yourLabelID); 
lbl.Text = 无论;


Can anyone Pls explain the use of e.row.findcontrol???

解决方案

It is used to find a particular control inside the container. For example if you have a label inside a gridview(in every row), now you want to set it''s text at runtime(based on a condition), then in the gridview''s RowDataBound event you will check for the condition and if that condition is matched you will find the label to set it''s text. For that you will be using e.Row.FindControl("yourLabelID") nad cast it as Label.

Label lbl = (Label)e.Row.FindControl("yourLabelID");
lbl.Text = "Whatever";


这篇关于是什么以及如何使用e.row.findcontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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