Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Unassigned: ModalPopupExtender within UpdatePanel and ContentTemplate - Not working [28021]

$
0
0
1. Environment :
* AjaxToolKit 15.1.4.0
* Visual Studio 2013 (Tested on Professional and Express both)
* .Net framework : Tested with both 4.0 and 4.5

2: Scenario : ModalPopupExtender within UpdatePanel and ContentTemplate

3: Issue : Modal window becomes unresponsive and can't close. Modal window also becomes transparent and can see the content of main page in Modal window.

4: More Detail: Above issue occurs after opening and closing modal window for few times i.e 10 times. I have few pages where I can open Modal window 2 times, 3 times and 10 times but after that above mentioned issue occurs. This issue does not occurs if main page content is over just above modal window position, but if any content of main page goes below Modal window position then this issue occurs.

5: Here is sample code. Please try it to experience the issue.

.ASPX code
--------------

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AjaxToolKit.Default" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblMessage" runat="server" ForeColor="Green" /><br />
<br />
<asp:Button ID="btnAddPerson" runat="server" CausesValidation="False"
Text="Add Person" Width="100px" UseSubmitBehavior="False" OnClick="btnAddPerson_Click" /><br />

After opening model window for 10 times it does not close on 11th time.
<br />
I have couple of other pages where I can open model window for 2 and 5 time respectively.
<br />
So if you can close on 11th time then continue testing for some more time eventually it would not close.
<br />
<strong style="color: red;">If the content of main page is over just above the modal window position then it works properly. When there is a content below modal window then this issue occurs.<br />
Remove below two paragraph and try again, it would work!
</strong>
<p>
<br /><br /><br /><br /><br /><br /><br /><br />

After opening model window for 10 times it does not close on 11th time.
<br />
I have couple of other pages where I can open model window for 2 and 5 time respectively.
<br />
So if you can close on 11th time then continue testing for some more time eventually it would not close.
<br />
<br />
</p>
<p>
<br /><br /><br /><br /><br /><br /><br /><br />
After opening model window for 10 times it does not close on 11th time.
<br />
I have couple of other pages where I can open model window for 2 and 5 time respectively.
<br />
So if you can close on 11th time then continue testing for some more time eventually it would not close.
<br />
<br />
</p>

<asp:Button ID="btnShow" runat="server" Text="Show Modal Popup" Style="display: none;" />
<!-- ModalPopupExtender -->
<cc1:ModalPopupExtender ID="mp1" runat="server" PopupControlID="Panel1" TargetControlID="btnShow"
CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" align="center" Style="display: none; border: solid; background-color:skyblue;">
This is an ASP.Net AJAX ModalPopupExtender Example<br />
<asp:Button ID="btnSave" runat="server" Text="Save" CausesValidation="True" UseSubmitBehavior="True" OnClick="btnSave_Click" />
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>

</ContentTemplate>
</asp:UpdatePanel>


</form>
</body>
</html>


Code Behind
---------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AjaxToolKit
{
public partial class Default : System.Web.UI.Page
{
protected void btnAddPerson_Click(object sender, EventArgs e)
{

mp1.Show();

}

protected void btnSave_Click(object sender, EventArgs e)
{

if (lblMessage.Text == "Saved!")
lblMessage.Text = "Saved Saved!";
else
lblMessage.Text = "Saved!";
mp1.Dispose();


}

}
}
Comments: Code is already attached in this issue, see above I have provided both .aspx file code and code behind code. Create new c# web project, by default visual studio will add Default.aspx file to your project, replace content in default.aspx code with above provided content and also replace code behind from above. If you set name of your project to "AjaxToolKit" then you will not have make a single change in above code.

Viewing all articles
Browse latest Browse all 4356

Trending Articles