Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 280955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:09:45+00:00 2026-05-12T05:09:45+00:00

I have an aspx page with three web controls: one to control the List

  • 0

I have an aspx page with three web controls: one to control the List Users page, one to control the Edit Users page, and one to control the Add User page. I have discovered a method for accessing these elements, but it seems to be limited. Here is what I have done:

Protected Sub editUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs)
        'set selected user from gridview.
        Dim index As Integer = e.NewEditIndex
        Dim userId As Integer = gvListUsers.DataKeys(index).Value
        Session.Item("SelectedUserId") = userId

        'show edit page, hide list and add page.
        With Page.Form.Controls(1)
            .Controls(getControlId("loadAddUser")).Visible = False
            .Controls(getControlId("loadEditUser")).Visible = True
            .Controls(getControlId("loadListUser")).Visible = False
        End With
    End Sub

The getControlId function looks like this:

Public Function getControlId(ByVal control As String) As Integer
        Dim enumer As System.Collections.IEnumerator = Page.Form.Controls.Item(1).Controls.GetEnumerator
        Dim i As Integer

        For i = 0 To (Page.Form.Controls.Item(1).Controls.Count - 1)
            If Page.Form.Controls(1).Controls.Item(i).ID = control Then
                Return i
            End If
        Next
        Return Nothing
    End Function

This works in most cases. However, I am unable to access the “enabled” attribute of these web controls. Why is this, and how might I access that attribute?

Thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T05:09:45+00:00Added an answer on May 12, 2026 at 5:09 am

    You could raise events from your UserControls which you subscribe to in the parent ASPX page. In the parent page event action you could enable/disable your controls,

    Here’s an example of events in UserControls: http://codebetter.com/blogs/brendan.tompkins/archive/2004/10/06/Easily-Raise-Events-From-ASP.NET-ASCX-User-Controls.aspx

    Something else to think about: are you getting any benefit from moving this code into usercontrols? Would any of the individual controls be re-usable on their own? Creating tightly coupled controls that rely on each other being present doesn’t give you much re-usability of the individual controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 324k
  • Answers 324k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you intend to always return an empty enumerable then… May 14, 2026 at 1:22 am
  • Editorial Team
    Editorial Team added an answer Remove the document prefix, so lightbox.appendChild(msg); This will be because… May 14, 2026 at 1:22 am
  • Editorial Team
    Editorial Team added an answer Not sure of what you are asking, but have you… May 14, 2026 at 1:22 am

Related Questions

In one of my projects I need to build an ASP.NET page and some
I have quite simple site structure with one mastepage and a bunch of pages.
IIS enables us to also configure Asp.Net file mappings. Thus besides aspx, IIS also
I have an ASP.net webforms app that connects to a web service, All the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.