Solved

ModalPopup TargetControlID is a Control Inside a DetailsView

Posted on 2007-04-10
4
2,144 Views
Last Modified: 2008-01-09
Hi,

I have a details view which I am using in Insert Mode to insert a record into a DB. One of the fields in my DetailsView is a DropDownList, next to the DDL is a LinkButton. I would like a Modal PopUp to appear when that LinkButton is clicked, which allows the user to quickly add something to the DropDownList.

 I have it all working when my LinkButton which I am using as the TargetControlID is outside of my DetailsView, but when it is in the DetailsView, and I change the TargetControlID to use it's full name, the Modal PopUp appears, but then closes. It's only on the screen for a few milliseconds.

I have two LinkButtons, one inside the DetailsView, another outside the DetailsView, the outside one is hidden, I then use the OnClientClick method to force the hidden LinkButton to be clicked when the link button inside the DetailsView is clicked.

 Here is some of my code:

 <asp:LinkButton ID="cmdAddNewEvidenceType" runat="server" OnClientClick="ctl00_cphBodyText_cmdHiddenAddNewEvidenceType.click();" Text="Add New" />

<

asp:LinkButton ID="cmdHiddenAddNewEvidenceType" runat="server" Style="visibility: hidden" />

<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" TargetControlID="cmdHiddenAddNewEvidenceType"

PopupControlID="palAddEvidenceItemType" BackgroundCssClass="modalBackground" CancelControlID="cmdCancelAdd"

DropShadow="True" PopupDragHandleControlID="palHeader">

</ajaxToolkit:ModalPopupExtender>
 Thanks

 Andrew
0
Comment
Question by:ttnetworks
  • 2
  • 2
4 Comments
 
LVL 7

Accepted Solution

by:
here4u247 earned 500 total points
ID: 18881130
hey Andrew,

what you can do is find out what the dynamic ID the .net gives your cancel/ok button that are inside the details view and assign them in the CancelControlID or OkControlID, usually the ID that .net generates are somewhat like:

MyDetailsview1$MyOkButtonID


hope that make sense...
0
 

Author Comment

by:ttnetworks
ID: 18882598
That's not really what I am after, my OK and Cancel buttons work fine, they do everything I want them to do.

What I am trying to do is get the Modal PopUp to be triggered from a LinkButton inside a DetailsView.

I have tried to use the ID .Net Generates, but either I am getting the ID or wrong, or the TargetControlID does not support them, as it does not seem to want to work!!

Andrew
0
 
LVL 7

Expert Comment

by:here4u247
ID: 18882884
you can assign the .net generated id, i've tried it many times, now where did you place the DetailsView? can i see your code structure?
0
 

Author Comment

by:ttnetworks
ID: 18898876
Alright, got it working with the full unique control ID. I was missing the Content Place Holder tag. I'll close this now, but I have a new AJAX problem!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

13 Experts available now in Live!

Get 1:1 Help Now