Solved

Using a dynamic Controls ID as TargetID for ModalPopupExtender

Posted on 2008-06-16
1
2,484 Views
Last Modified: 2013-11-07
Hi,

I have a number of dynamically generated buttons added to an ajax accordion. I also have a modalPopup extender to popup a panel. I want the dynamic buttons to popup the panel. Currently I have the following: (default)

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Button1"
          PopupControlID="pnlJobDetails"
            CancelControlID="cmdClose"
           BackgroundCssClass="modalBackground"
/>

I want to be able todo something like:

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID=AccordionPane1.Controls(0).Controls
          PopupControlID="pnlJobDetails"
            CancelControlID="cmdClose"
           BackgroundCssClass="modalBackground"
/>

or other, if you can think of a better way of doing this please let me know. Basically I have a number of SupportJobs which are represented by the buttons on the accordion panel, added dynamically based on an SQL query. I then want to be able to pop the modal panel by pressing one of the buttons which lets you edit the details of each job, I will have to pass in the JOBID to the panel which is stored as the text property on each button.

Thanks in advance.

James.
0
Comment
Question by:Steve_Buck
1 Comment
 

Accepted Solution

by:
Steve_Buck earned 0 total points
ID: 21811209
I have a fix I worked out myself!

At the point I add the button I add a handler event:


Public Function CreateButton()
 Dim a As New Button
AddHandler a.Click, AddressOf AddDynBtnEvtHdr
End Function


Public Sub AddDynBtnEvtHdr
Dim mpe As AjaxControlToolkit.ModalPopupExtender = UpdatePanel1.ContentTemplateContainer.FindControl("ModalPopupExtender1")
mpe.show
End Sub

As you can see above I then just call the show method and bingo! it pops the form. I can pass into the session the JobID so I can edit a specific job on the modal panel.

Hope this might help someone.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question