Solved

Using a dynamic Controls ID as TargetID for ModalPopupExtender

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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