Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

ASPX Page Control Enable / Disable

Posted on March 12, 2014October 26, 2015 By David Kittell

In some cases you need to disable controls on a page, this will help you disable various types of controls.

protected void ControlsEnabler (Control parent, bool State)
		{
		foreach (Control c in parent.Controls)
			{
			if (c is TextBox)
				{
				((TextBox)(c)).Enabled = State;
				}
			if (c is CheckBox)
				{
				((CheckBox)(c)).Enabled = State;
				}
			if (c is RadioButton)
				{
				((RadioButton)(c)).Enabled = State;
				}

			if (c is Button)
				{
				((Button)(c)).Enabled = State;
				}
			ControlsEnabler(c, State);
			}
		}
ControlsEnabler(Page, false);
Originally Posted on March 12, 2014
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

C# ASPX Code CSharp

Post navigation

Previous post
Next post

Related Posts

Classic ASP Send Email

Posted on March 3, 2014May 25, 2017

<% Set myMail=CreateObject("CDO.Message") if Request("subject") <> "" then myMail.Subject=Request("subject") else myMail.Subject="<Subject>" end if if Request("from") <> "" then myMail.From=Request("from") else myMail.From="<From Email Address>" end if if Request("To") <> "" then myMail.To=Request("To") else myMail.To="<To Email Address>" end if if Request("Cc") <> "" then myMail.CC=Request("Cc") else myMail.CC="<CC Email Address>" end if myMail.TextBody=…

Read More

Azure CLI – Convert VM Dynamic IP to Static IP

Posted on April 5, 2018

If you create your VM with Dynamic IPs DHCP will grab the first available IP but some VMs are best on a static IP. This script below will get the existing IP of the ipconfig and reassign it to the same ipconfig as a static IP. Dynamic_To_Static () { nic="$4"…

Read More

Ektron Content List

Posted on July 2, 2015

This is a collection of a few other scripts that I’ve posted here but this script concatenates widget and alias listings into one column so that you only have one row per content item. SET NOCOUNT ON DECLARE @Domain VARCHAR(50) SET @Domain = ‘/’ SELECT –TOP 30 CASE WHEN c.content_type…

Read More

Code

Top Posts & Pages

  • Bleaching Wool using Hydrogen Peroxide
  • Front Page
  • PowerShell - Rename Pictures to Image Taken
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • Bleaching Wool using Hydrogen Peroxide
  • PowerShell - Rename Pictures to Image Taken
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - IPv4 Range
  • PowerShell - Install .NET 4.5.2
©2025 David Kittell | WordPress Theme by SuperbThemes