Solved

Using a dynamic Controls ID as TargetID for ModalPopupExtender

Posted on 2008-06-16
1
2,489 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
This article discusses how to implement server side field validation and display customized error messages to the client.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

688 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