Private Function GetWebDataGridOKButtonId() As String
Dim ctls As ControlCollection = _
WebDataGrid1.Controls(0).Controls(0).Controls
Dim btn As Button
Dim qry = From item As Control In ctls _
Where item.ID = "ButtonOK" _
Select item
btn = qry.ToList()
Return btn.ClientID
End Function
This is not working for me. I am trying to iterate a control collection and return one control ID. I am kind of a newbie to linq.
Thanks,
~ck
I assume that you think there’s only one button with a button ID of “ButtonOK”? If so, then replace
with
and things will be how you expect. Right now, you’re getting back a
List<T>of one item, not a reference to a single item.