Dialog.show() comand not working when in user control

This post has 5 replies

Not Ranked
Posts: 4
solcara Posted: Wed Jan 30, 2008 @ 2:54 AM
I have added a component art dialog control to an user control and can no longer open the dialog in my page using dialog.show() (in IE) which was working fine outside the user control. I can open the dialog control in firefox however but the close() method doesn't work.

Here's is my code

TestUserControl.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestUserControl.aspx.cs" Inherits="TestUserControl" %>
<%@ Register TagPrefix="Dialog" TagName="CADialog" Src="TestUserControl.ascx"%>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>

<form id="form1" runat="server">
<Dialog:CADialog ID="CADialog1" runat="server" />
</form>
</body>
</html>

User control
TestUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestUserControl.ascx.cs" Inherits="TestUserControl" %>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<script type="text/javascript">
function showHelpDialog(){
//window.CADialog1_ShowPageHelp.show();
//ShowPageHelp.set_content(' ');
ShowPageHelp.show();
return false;
}

function hideHelpDialog(){
//CADialog1_ShowPageHelp.close();
ShowPageHelp.close();
return false;
}
</script>
<img src="App_Themes/SolcaraStandard/Images/Banner/QuestionMark.gif" style="cursor:pointer" alt="How to use this page" title="How to use this page" onclick="showHelpDialog();" />
<ComponentArt:Dialog
ID="ShowPageHelp"
skinid="Standard"
Title="How to use this page"
HeaderClientTemplateId="header"
runat="server">
<ClientTemplates>
<ComponentArt:ClientTemplate id="header">
<img src="App_Themes/SolcaraStandard/Images/Dialog/close.gif" onclick="hideHelpDialog();" />
</ComponentArt:ClientTemplate>
</ClientTemplates>
</ComponentArt:Dialog>

I have noted that I seem to be experience a simular problem to this post

http://www.componentart.com/forums/ShowPost.aspx?PostID=32105

After changing the code to lowercase show() the following happens:

in IE:
When clicking on the context menu, I can trace the code into the Toggle() javascript function. However I get a Object Required exception back and the code then shows me the following:


function anonymous() {
var returnValue = this.Show.apply(this,arguments);return returnValue;
}



where this references the dialog popup control.

in FireFox:
1. when clicking on the context menu the popup control is displayed fine, but the context menu does not disappear until I click on the popup itself.
2. when I click the close button on the popup nothing happens.
Not Ranked
Posts: 4
solcara Posted: Thu Jan 31, 2008 @ 3:02 AM
I found out the problem is in the code contained in the skin.

AnimationType="Live" seems to be causing the problem. If I set it to "None" the show and close methods work ok.

AnimationType="Outline" also causes the same problem.

And moving the AnimationType out of the skin back in to the control does not fix the problem so the fact it was in a skin is irrelevant.
Top 500 Contributor
Posts: 26
trinit Posted: Thu Feb 19, 2009 @ 6:48 AM
Hi there,

I can confirm the problem stated above.

Changing AnimationType="Live" to "None" solves the problem.

It seems that one or more events can't be handled.

Attila
Top 10 Contributor
Posts: 6,149
stephen Posted: Thu Feb 26, 2009 @ 11:18 AM
I just updated the other thread we were talking in- this does appear to be a bug, unfortunately. The live animation type throws an error when the dialog is inside of another control. As noted, I'll log this for investigation, and sorry for the trouble.
Stephen Hatcher, Developer Support Manager
Top 75 Contributor
Posts: 59
chris.manker Posted: Thu Jan 12, 2012 @ 7:36 AM
I'm having the same problem with web.ui 2011, only with the closing the dialog.  Nothing seems to happen when I use the below code server side.  I just want to close the dialog at the end of the login script.  Doesn't seem to do anything.  IE7

dlg_login.Visible =

 

False

(by the way, your online documentation is throwing errors for me serverside/dialog)

Top 10 Contributor
Posts: 6,149
stephen Posted: Thu Jan 12, 2012 @ 7:58 AM

I can't see your code, obviously, so there's only limited help I can give here... how are you getting to this code on the server- a callback? an update panel? The best approach isn't to use the server hide/ show methods, since this is a client control, but instead rely on client events to show and hide the dialog. So, for example, if you were using a callback- wire the callbackcomplete event and close the dialog in the handler. 

Stephen Hatcher, Developer Support Manager
Page 1 of 1 (6 items)