Solved

ModalPopup TargetControlID is a Control Inside a DetailsView

Posted on 2007-04-10
4
2,147 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

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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 …

910 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

20 Experts available now in Live!

Get 1:1 Help Now