在转发器中,在headertemlate控件事件下查找itemtemplate的控件 [英] In a repeater Find control of itemtemplate under headertemlate control event
本文介绍了在转发器中,在headertemlate控件事件下查找itemtemplate的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
i在转发器控制中面临一个问题
我的要求是在转发器的headertemplate一个复选框,当我点击复选框然后所有itmetemplate复选框选择并取消选择
hello all,
i have facing one problem in repeater control
my requirement is in headertemplate of repeater one checkbox when i click of checkbox then all itmetemplate checkbox select and deselect
推荐答案
嘿那里,
在标题复选框的checkedChanged
事件,您需要循环遍历所有Repeater
项目,使用FindControl
查找CheckBox并设置其选中
与标题复选框相同的值。例如,
Hey there,
In the header checkbox'scheckedChanged
event, you need to loop through all theRepeater
items, find the CheckBox usingFindControl
and set itschecked
value same as the header checkbox. e.g,
CheckBox chkheader = (CheckBox) sender;
foreach (RepeaterItem item in Repeater1.Items)
{
CheckBox chkItem = (CheckBox) item.FindControl("YourCheckBoxID");
if (chkItem != null)
{
chkItem.Checked = chkheader.Checked;
}
}
希望有所帮助。
Azee ......
Hope it helps.
Azee...
这篇关于在转发器中,在headertemlate控件事件下查找itemtemplate的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文