I have a user control ascx file that has form data in it. I need to create a Modal Popup for this. I have dynamically created Link Buttons that have the same Handler "EditContact". These events are firing, but I'm so lost as to how to get my Modal Popup to display. I have searched around some, but I think I am missing some fundamental core and it is not clicking for me.
Here's my click event handler code behind. I am currently trying to create this from code behind which may or may not be the best way.
Dim cArg As String = (CType(sender, LinkButton).CommandArgument).ToString
Dim ajxModalEdit As New AjaxControlToolkit.ModalPopupExtender()
ajxModalEdit.ID = "mpeEditContact1"
ajxModalEdit.DropShadow = True
ajxModalEdit.TargetControlID = CType(sender, LinkButton).ID
ajxModalEdit.BackgroundCssClass = "modalBackground"
ajxModalEdit.PopupControlID = pnlContactInformationAddEdit.ID
Dim ucContactEdit As ucContactInformationAddEdit = CType(Page.LoadControl("~/uc/ucContactInformationAddEdit.ascx"), ucContactInformationAddEdit)
ucCIEdit.ParentControlID = pnlContactInformationAddEdit.ClientID
ucCIEdit.EditContactID = cArg
pnlContactInformationAddEdit.Controls.Add(ucCIEdit)
pnlContactInformationAddEdit.Controls.Add(ajxModalEdit)
ajxModalEdit.Show()My Questions:
- How do I dynamically assign my modal popup extender to that button click event handler?
- Can I / Should I dynamically create the modal popup extender (and its adjacent panels) in code-behind?
- Is there a better way to do this? Anyone have a link that creates the popups in code behind so I can link to the User Control?