Tag : .NET, Ms SQL Server 2005, Crystal Report, Web (ASP.NET), VB.NET, Web Service
Date :
2013-09-30 10:26:50
By :
sikaju
View :
2571
Reply :
4
No. 1
Guest
Code (C#)
List<CheckBox> cb = new List<CheckBox>();
(from gvr in GridView1.Rows.Cast<GrdiViewRow>()
select gvr).ToList().ForEach(gvr => {
(from c in gvr.Cells[0].Controls.Cast<Control>()
where c.GetType() == typeof(CheckBox)
select c).Select(c => (CheckBox)c).ToList().ForEach(c => cb.Add(c));
});
foreach(CheckBox c in cb)
{
// do something
}
Dim cb As New List(Of CheckBox)()
(From gvr In GridView1.Rows.Cast(Of GrdiViewRow)()gvr).ToList().ForEach(Function(gvr)
(From c In gvr.Cells(0).Controls.Cast(Of Control)() Where c.[GetType]() = GetType(CheckBox)c).[Select](Function(c) DirectCast(c, CheckBox)).ToList().ForEach(Function(c) cb.Add(c))
End Function)
' do something
For Each c As CheckBox In cb
Next