I am working in C#.Net. I am having ASPX Page and ASCX Page. In my ASCX page, there is a textbox and HTML Image button. I want to do the enable true and false process based on the dropdown selected index changed event. By default, the textbox should be disabled and Image should be visibled false.
Here is my ASPX Page Load..
ContentPlaceHolder cph = (ContentPlaceHolder)this.Page.Master.FindControl("ContentPlaceHolder1");
PI_CompLocationTree userCntrl = (PI_CompLocationTree)cph.FindControl("PI_CompLocationTree1");
userCntrl.TextBoxUSC = false;
userCntrl.ImgUSC = false;
if (analysisGroup.SelectedValue == "0")
{
userCntrl.TextBoxUSC = true;
userCntrl.ImgUSC = true;
}
else if (analysisGroup.SelectedValue == "1")
{
userCntrl.TextBoxUSC = true;
userCntrl.ImgUSC = true;
}
else
{
userCntrl.TextBoxUSC = false;
userCntrl.ImgUSC = false;
}
and my ASCX Code..
public bool TextBoxUSC
{
set { txtLoc.Enabled = value; }
}
public bool ImgUSC
{
set { imgEdit.Visible = value; }
}
The value are passing correctly to the property. But the textbox control is in disabled mode only and image is in visible false. How to enable and visible the controls.
EnabledandVisible, is that a typo in the post? - Hans Kesting