Solved

ModalPopup TargetControlID is a Control Inside a DetailsView

Posted on 2007-04-10
4
2,150 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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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