Hi,
My control has a public property called 'DisableBackground'.
e.g.
Control.ascx.cs
Code:
private bool _disableBackground;
private string _targetControl;
public bool DisableBackground
{
get { return _disableBackground; }
set { _disableBackground = value; }
}
public string TargetControl
{
get { return _targetControl; }
set { _targetControl = value; }
}
I set the value on the property when I use the control from an aspx page.
e.g.
Default.aspx.cs
Code:
<Controls:ModalWindow runat="server" TargetControl="btnTrigger" DisableBackground="true" />
I want to bind that property to the control
e.g.
Control.ascx
Code:
<ajaxToolkit:ModalPopupExtender ID="windowExtender"
runat="server"
BehaviorID="window"
TargetControlID="<%# this.TargetControl %>"
PopupControlID="panelWindow" />
I know that in the code behind I can find the control and then assign a value to the property.
e.g.
Control.ascx
Code:
if (_disableBackground)
{
AjaxControlToolkit.ModalPopupExtender popup = (AjaxControlToolkit.ModalPopupExtender)this.FindControl("windowExtender");
popup.BackgroundCssClass = "modalBackground";
}
popup.TargetControlID = _targetControl;
I was wondering if there is a simple way I can just bind the property to the control. All the examples I can find bind repeating data to the control but I just want to bind a single property or a few properties.
Thanks in advance,
Paul