Problem finding datagrid in Page.controls collection

R

Rob

You can find datagrid in page by refering the form.
Gatagrid is a child control of Form.

Here is the code
-----------------

Dim ctl As New Control
For Each ctl In Page.FindControl("form1").Controls
If TypeOf ctl Is DataGrid Then
Response.Write(ctl.ID)
End If

Next


Let me know if it works.
 
M

MS

Ok I figure it out it is the ID of page in HTML.Another question is; Is
there any way I can findout this property without hardcoding it?

Thanks in advance
 
R

Rob

You need to specify the data grid within the form.
Form1 is the id of Form. I think this answers your
question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top