Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Detailsview inside ModalPopup

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gsauns - 20 Dec 2007 22:14 GMT
I have a DetailsView inside a ModalPopup (using the AJAX
ModalPopupExtender).

I would like the user to have the ability to change the DetailsView's
mode within the ModalPopup.
But whenever I click the button to change the mode, the ModalPopup
closes itself. The NEXT time I open the ModalPopup, the mode has been
changed. So the mode is changing... my problem is that I need the
ModalPopup to stay visible.
Also, the DetailsView is inside an UpdatePanel within the Panel I am
popping up. The ModalPopupExtender's OKControlID and CancelControlID
are not within this UpdatePanel (but are inside the Panel).

I have downloaded an example that suggests that what I am trying to do
should work... am I misunderstanding something?

Code:

Target control:

<asp:LinkButton ID="lbtn" runat="server" Text="Modal"></
asp:LinkButton>
<cc1:ModalPopupExtender ID="modal" runat="server"
TargetControlID="lbtn" PopupControlID="pnl" DropShadow="true"
Drag="true" CancelControlID="btnCancel" OkControlID="btnOk"
BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>

Panel:

<asp:Panel ID="pnl" runat="server" Height="400px" Width="900px"
BackColor="Khaki">
<asp:UpdatePanel ID="UpdatePanel9" runat="server">
<ContentTemplate>
<asp:DetailsView ID="dv" runat="server" Width="100%" DataKeyNames="ID"
DataSourceID="ds" DefaultMode="ReadOnly" AutoGenerateRows="false">
<Fields>
...
</Fields>
<FooterTemplate>
// Buttons that change the mode
</FooterTemplate>
</asp:DetailsView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnOk" runat="server" Text="OK" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</asp:Panel>
<
Mike Placentra II - 23 Dec 2007 02:55 GMT
> ...whenever I click the button to change the mode, the ModalPopup
> closes itself. The NEXT time I open the ModalPopup, the mode has been
> changed. So the mode is changing... my problem is that I need the
> ModalPopup to stay visible.

I've had this problem before. You need to reopen the modal popup on
the server side in the DetailView's ItemUpdating event:

Protected Sub gsaunsdv_ItemUpdating(ByVal sender As Object, _
 ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) _
 Handles <DETAILSVIEW-ID>.ItemUpdating
   <MODAL-ID>.Show()
End Sub

You may want to do that in other events too (such as ItemInserting).

> Also, the DetailsView is inside an UpdatePanel within the Panel I am
> popping up. The ModalPopupExtender's OKControlID and CancelControlID
> are not within this UpdatePanel (but are inside the Panel).

I would just put all of that in the UpdatePanel to avoid problems.

-Michael Placentra II

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.