datagrid模板列中,标题也是模板,而且有控件,程序中如何得到该控件呢? (CheckBox)this.dg_results.Items[i].FindControl("cb_download_item");这对数据行自然是可以的,但对于标题行和脚注部分该如何用呢????还请指教谢谢。。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 对于页面页脚的部分,可以如下:foreach (DataGridItem item in DataGrid1.Controls[0].Controls){ if (item.ItemType == ListItemType.Header) { //用item.FindControl查找相应的控件 }}参考http://community.csdn.net/Expert/topic/3490/3490091.xml?temp=.9209864 比如说,如下:foreach (DataGridItem item in DataGrid1.Controls[0].Controls){ if (item.ItemType == ListItemType.Header) { CheckBox cb = (CheckBox)item.FindControl("yourCheckBoxID"); ........ }} brightheroes(闭关|那一剑的风情) 正解 我一天始就想到用:foreach (DataGridItem item in dg_results.Items) { if (item.ItemType == ListItemType.Header) { ((CheckBox)item.FindControl("cb_download_all")).Checked=false; } }谁知道不行,因为dg_results.Items.Count=数据行的行数没想到。。谢谢brightheroes(闭关|那一剑的风情) 求个正则,多谢 求获取百度音乐搜索结果列表的正则表达式, C#下播放mp3最简单的方法 被扣积分了,迷惑中…… 线程操作中我要是给函数传参怎么办? 查找字符串的问题,求一正则表达式 VS2008 WPF中使用openfiledialog问题 委托与方法在实际中有什么区别啊,虽然可能理解委托相当于对方法的引用,但在实际的开发中,什么时候能用到委托呢? 大型文件的切分方法 C#中如何写Excel的物理式子? winForm里执行win应用程序,如何使打开的form最大化,并且永远在前面 求3DES算法的例子
{
if (item.ItemType == ListItemType.Header)
{
//用item.FindControl查找相应的控件
}
}参考
http://community.csdn.net/Expert/topic/3490/3490091.xml?temp=.9209864
foreach (DataGridItem item in DataGrid1.Controls[0].Controls)
{
if (item.ItemType == ListItemType.Header)
{
CheckBox cb = (CheckBox)item.FindControl("yourCheckBoxID");
........
}
}
{
if (item.ItemType == ListItemType.Header)
{
((CheckBox)item.FindControl("cb_download_all")).Checked=false;
}
}
谁知道不行,因为dg_results.Items.Count=数据行的行数
没想到。。谢谢brightheroes(闭关|那一剑的风情)