Solved

ModalPopup TargetControlID is a Control Inside a DetailsView

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

776 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