如何在中继器中找到控件 [英] how to findcontrol in repeater
本文介绍了如何在中继器中找到控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在中继器中找到控制器
我创建了一个中继器
i已添加
var lbl = new Label();
lbl.ID = lbl;
var img = new Image();
img.ID = img;
c#代码和
RepeaterStrongestSkillsMax2。 Controls.Add被(IMG);
RepeaterStrongestSkillsMax2.Controls.Add(lbl);
现在我正在尝试foreach(var v in Repeater)
{
//这里我想找到我创建的控件(lbl和img)
}
解决方案
Label label = 空跨度>;
foreach (RepeaterItem i in rpt.Items)
{
label =(Label)(i.FindControl( lbl));
}
希望它能帮到你.Goodluck
how to findcontrol in repeater
I have created a repeater
i have added
var lbl = new Label();
lbl.ID = "lbl";
var img = new Image();
img.ID = "img";
in c# code and also
RepeaterStrongestSkillsMax2.Controls.Add(img);
RepeaterStrongestSkillsMax2.Controls.Add(lbl);
Now i am trying to foreach (var v in Repeater)
{
// Here i would like to find the controls that i have created(lbl and img)
}
解决方案
Label label= null; foreach (RepeaterItem i in rpt.Items) { label=(Label)(i.FindControl("lbl")); }
Hope it will help you.Goodluck
这篇关于如何在中继器中找到控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文