Thanks Charles, this seems to work quite well. Carole
> ASP.net Unleashed Page 214 shows you how to walk controls.
Heres an adaptation of that code.
Call Trace_Controls(page)
SUB Trace_1Control(p1Ctrl as control, p2CtrlName as string)
with trace
.warn ("SUB Trace_1Control","start")
.write (p2CtrlName,p2CtrlName & ".ClientID=" &
p1Ctrl.ClientID)
.write (p2CtrlName,p2CtrlName & ".Type=" &
p1Ctrl.GetType.ToString())
.write (p2CtrlName,p2CtrlName & ".ID=" &
p1Ctrl.ID)
.write (p2CtrlName,p2CtrlName &
".NamingContainer.ToString()=" & p1Ctrl.NamingContainer.Tostring())
.write (p2CtrlName,p2CtrlName &
".Page.ToString()=" & p1Ctrl.Page.ToString())
.write (p2CtrlName,p2CtrlName &
".Parent.ToString()=" & p1Ctrl.Parent.ToString())
.write (p2CtrlName,p2CtrlName & ".UniqeID=" &
p1Ctrl.UniqueID)
.warn ("SUB Trace_1Control","end")
end with
END SUB
Sub Trace_Controls(p1Ctrl as object)
DIM ctrl1 as control
FOR each ctrl1 in p1Ctrl.Controls
Trace_1Control(ctrl1,ctrl1.id)
Trace_Controls(ctrl1)
NEXT
END SUB
At 09:18 PM 1/23/2003 +0000, you wrote:
>I am attempting to loop thru the controls on my page and inspect the
>CommandName property to possibly disable specific buttons for certain
>users.
>
>When I attempt to loop thru the controls:
>------------------
>Dim control As Control
>
>For Each control In Me.Controls
> Response.Write("control id = " & control.ID & "<BR>")
>Next control
>--------------
>I get only the name of the form (and a few blank id's) returned.
>
> >From what I can tell -- I need to loop thru the Child controls in my
form.
>
>First of all, is that my problem? Second of all, how do I do it, I
>cannot locate an example online or in .NET books.
>
>Thanks for any advice!
>
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or
>to unsubscribe send a blank email to
>
>---
>[This E-mail scanned for viruses by Declude Virus]
---
[This E-mail scanned for viruses by Declude Virus]