Attributes of Controls on a Page

Discussion in 'ASP .Net' started by mosscliffe, May 23, 2006.

  1. mosscliffe

    mosscliffe Guest

    I am still very new to all this, so please bear with me.

    I am trying to create a debugButton, which when pressed would give me a
    list of all the controls on a page and their attributes, but I just
    can't work out the syntax. I have tried lots of combinations of the
    code below, but rather than show that I will show it in pseudo code


    dim cntrl as control
    dim attr as attribute

    for each cntrl in page.controls

    response.write("Control: " & cntrl.name & "Type: " & control.type &
    "<BR>")

    for each attr in cntrl.attributes

    if not isnothing(cntrl.attibute) then
    response.write(attr.name & " = " & attr.value)
    next
    next


    You will see from the above how naive I am in VB OOP syntax

    Thanks

    Tim
     
    mosscliffe, May 23, 2006
    #1
    1. Advertising

  2. There is already built-in support for this. See:

    http://msdn2.microsoft.com/en-US/library/hfe9f0s0.aspx

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Numbskull

    The man who questions opinions is wise.
    The man who quarrels with facts is a fool.

    "mosscliffe" <> wrote in message
    news:...
    >I am still very new to all this, so please bear with me.
    >
    > I am trying to create a debugButton, which when pressed would give me a
    > list of all the controls on a page and their attributes, but I just
    > can't work out the syntax. I have tried lots of combinations of the
    > code below, but rather than show that I will show it in pseudo code
    >
    >
    > dim cntrl as control
    > dim attr as attribute
    >
    > for each cntrl in page.controls
    >
    > response.write("Control: " & cntrl.name & "Type: " & control.type &
    > "<BR>")
    >
    > for each attr in cntrl.attributes
    >
    > if not isnothing(cntrl.attibute) then
    > response.write(attr.name & " = " & attr.value)
    > next
    > next
    >
    >
    > You will see from the above how naive I am in VB OOP syntax
    >
    > Thanks
    >
    > Tim
    >
     
    Kevin Spencer, May 23, 2006
    #2
    1. Advertising

  3. mosscliffe

    mosscliffe Guest

    Thanks for that tip, I had not got as far as investigating trace. That
    has raised many more questions.

    The most obvious one is why my button1 routine is not in the Trace
    Information List.

    But I would still like to achieve my original request, so that I can
    create a page, for documentation purposes, that gives me a list of the
    attributes, which have been set for each control.

    Thanks

    Tim
     
    mosscliffe, May 23, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    1
    Views:
    482
    Joe Kesselman
    Sep 22, 2006
  2. P4trykx
    Replies:
    2
    Views:
    1,822
    bruce barker
    Jan 31, 2007
  3. james_027

    class attributes & data attributes

    james_027, Jun 20, 2007, in forum: Python
    Replies:
    2
    Views:
    374
    Bruno Desthuilliers
    Jun 20, 2007
  4. Kyle Schmitt
    Replies:
    3
    Views:
    192
    Kyle Schmitt
    Jul 24, 2007
  5. Jayden
    Replies:
    16
    Views:
    526
    Steven D'Aprano
    Sep 29, 2012
Loading...

Share This Page