Hi basically i want to create a Control that can add popup to menuItems which is declared in the markup of the page. I would like the syntax to be like below:
<uc1:Sidebar id="" runat="server" enablePopup="True">
<PopUpBindings>
<PopedControlId="" BackgroundClass="" TargetItemIndex=""/>
<PopedControlId="" BackgroundClass="" TargetItemIndex=""/>
..
</PopUpBindings>
</uc1:Sidebar>
I am able to create enablePopUp using Member Fields in the asmx Page. Like Below
private bool _enablePopup;
public Boolean EnablePopup
{
get { return _enablePopup; }
set { _enablePopup = value; }
}
but creating a bindings set as in markUp 1. Never done that before. Could someone give hints to this.
Question 2:
This usercontrol is being created because modalPopup could not be created along with Repeater’s Databinding. I tried the below in repeaters ItemDatabound event but would throw exception “Target control Id ={0} could not be found”
mpcpnlNewBp.TargetControlID = e.Item.ID;//open modalpopup
What you need is Collection properties on your control – see this example code from MSDN to get an idea.
If more designer support such as UI for editing properties is needed then you need to create Collection Editor – check this related example.
EDIT:
With templated controls such as repeater, target control needs to be found in the correct parent control context which Modal Popup cannot do. The solution is to use a dummy (hidden) control on the page/user control as a target control for the modal popup and then use extender’s java-script API to hide/show popup as per needs (see this article for client side API).