no need to check for the id, you can directly check if the control is a
datagrid:
for each control as Control in Page.Controls
if control is DataGrid then
dim grid as DataGrid = ctype(control, DataGrid)
'can use the grid and get hte id via grid.Id
end if
next
Controls are embedded however, so you need to recursively loop:
sub LookForGrid(Con trol Parent)
for each control as Control in Parent
if control is DataGrid then
dim grid as DataGrid = ctype(control, DataGrid)
'can use the grid and get hte id via grid.Id
end if
if control.HasCont rols then
LookForGrid(con trol)
end if
next
end sub
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Tina" <ti**********@r emovespamexcite .com> wrote in message
news:uo******** ******@TK2MSFTN GP14.phx.gbl...
I need to find all of the datagrids on a page. How can I iterate through
all of the controls on a page to get their name and grab them as an
object? thanks,
T