forum

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

Set the Enabled Property of a UserControl From CodeBehind

Takeshi Okada 1687 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

Can you answer this question?


Answer

1 Answers

Liked By