DeveloperSection

Home / DeveloperSection / Forums / Set the Enabled Property of a UserControl From CodeBehind

Set the Enabled Property of a UserControl From CodeBehind

Takeshi Okada 1590 03-Dec-2014

It's been a while since I worked on WebForms so I need a refresher when working on an old site. 

I have a userControl on the page that I need to programatically set the enabled state 

<%@ Register Src='CalandarControl.ascx' TagName='CalandarControl' TagPrefix='uc' %>

I have this at the C# code but Enabled is not available here. What am I missing? 

if (c is UserControl)
{
    var x = c.GetType();
    if (x.Name == 'calendarcontrol_ascx')
    {
        ((UserControl)c).Enabled = true;
    }
}

Thanks


Updated on 04-Dec-2014
Takeshi Okada

Takeshi Okada

Leave Answer


Please enter your answer.


1 Answers

Liked By