Solved

Using a dynamic Controls ID as TargetID for ModalPopupExtender

Posted on 2008-06-16
1
2,482 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Loop not working 29 47
Anyway to make "All" the default in the dropdown? 6 34
Run time Error 4 34
C#.NET and microsoft certification. 3 34
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now