How Do I set enabled to false on all but one web control on a page

Discussion in 'ASP .Net Web Controls' started by Karen Grube, Nov 24, 2004.

  1. Karen Grube

    Karen Grube Guest

    Hi!

    What I need to do is loop through all the web controls on a page where
    the tabindex is > 6 and set enabled to false.

    I've got about 60 controls on a page and would rather not have to set
    each one individually. Any suggestions? Here's a snippet of code I found
    and tried to modify but it doesn't work. I know this is wrong (incomplete) ,
    but I'm not sure how to get to the value of the tabindex property, test it,
    and then set the enabled property on that control.

    Dim control As Control
    Dim t As System.Type
    For Each control In Page.Controls
    t = control.GetType().GetProperty
    If t = 1 Then
    CType(control, TextBox).Enabled = False
    End If
    Next

    Thanks!
    Karen Grube
    Karen Grube, Nov 24, 2004
    #1
    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. Gill Smith
    Replies:
    4
    Views:
    8,850
    Gish Smith
    May 22, 2004
  2. Keith Murray
    Replies:
    1
    Views:
    719
    Chris R. Timmons
    Oct 2, 2005
  3. elaine
    Replies:
    2
    Views:
    429
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    May 24, 2007
  4. Dave E

    Enabled set to false but still able to use datagrid

    Dave E, Jun 7, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    228
    Michelle Hlaing
    Feb 15, 2005
  5. Aymer

    web control enabled=false

    Aymer, Sep 3, 2003, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    150
Loading...

Share This Page