Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
Scott Davis  
#1 Posted : Friday, February 12, 2010 1:56:19 AM(UTC)
Scott Davis

Rank: Member

Groups: Member
Joined: 2/12/2010(UTC)
Posts: 17

I've been demo'ing the ImageUploader product for the past several weeks to ensure that it will work with my project. I have ran into a couple of snags that I've not been able to find solutions for on the forums. I've worked up a sample to demonstrate the problem and tried to keep it as simple as I can.

I am using ComponentArt controls in this project and am using their modal dialog control. In some cases within the application, users will be looking at a list of items. They can click an item to open an editor in a modal dialog (this is also done using asp.net ajax UpdatePanels). On the editor in the modal dialog they can click another link to open another modal (on top of the existing one) which will display the Aurigma ImageUploader.

I have gotten all of this to work fine...the first time. A user can click an item to edit it and upload an image. However, after closing the modals and selecting an item to edit again and then trying to upload another image I get the "Image Uploader encountered some problem. If you see this message, contact web master."

I do have ShowDebugWindow set to true...this is all of the error information that I am getting.

If I disable the ActiveX version of the ImageUploader and force it to use the Java version, it works fine.

If I leave ActiveX enabled and place the Aurigma control on the first modal dialog (the editor) rather than on a second modal dialog that opens on top of the editor...it also works.

There seems to be some sort of problem occurring with using the ActiveX Aurigma control in a nested modal dialog (at least with the ComponentArt modal dialog control).

I know this is a bit complex, but I'm hoping someone might be able to give me an idea of what could be happening so that I can move past this problem and purchase the Aurigma control.

Here is the sample code that I've been able to work up. Any help would be greatly appreciated.

Main.aspx
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="TestWebApplication.AurigmaTest.Main" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<%@ Register Src="ItemEditor.ascx" TagName="ItemEditor" TagPrefix="uc2" %>
<!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></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server">
    </asp:ScriptManager>
    <div>
        <table width="100%">
            <tr>
                <td>
                    <asp:UpdatePanel ID="upd1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ItemNumber"
                                OnRowCommand="GridView1_RowCommand">
                                <Columns>
                                    <asp:ButtonField CommandName="Select" Text="Select" />
                                    <asp:BoundField DataField="ItemNumber" HeaderText="Item" />
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
        <cc1:UpdatePanelAnimationExtender ID="upd1_UpdatePanelAnimationExtender" runat="server"
            Enabled="True" TargetControlID="upd1">
            <Animations>
        <OnUpdating><EnableAction Enabled="false"></EnableAction></OnUpdating>
        <OnUpdated><EnableAction Enabled="true"></EnableAction></OnUpdated>
            </Animations>
        </cc1:UpdatePanelAnimationExtender>
        <asp:UpdatePanel ID="updEditor" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <ComponentArt:Dialog Modal="true" AllowDrag="true" Alignment="MiddleCentre" ID="mdlEditor"
                    runat="server" Height="500" Width="615">
                    <Content>
                        <asp:Panel ID="pnlContent" runat="server" Width="100%">
                            <table cellpadding="8" cellspacing="0" width="100%">
                                <tr onmousedown="mdlAddImage.StartDrag(event);">
                                    <td>
                                        <asp:Label ID="lblTitle" runat="server" Text="Editor"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <asp:UpdatePanel ID="updEditor2" runat="server" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                <uc2:ItemEditor ID="ItemEditor1" runat="server" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </td>
                                </tr>
                            </table>
                        </asp:Panel>
                    </Content>
                    <Footer>
                    </Footer>
                </ComponentArt:Dialog>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>


Main.aspx.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.IO;

namespace TestWebApplication.AurigmaTest
{
	public partial class Main : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			ItemEditor1.Close += new EventHandler(ItemEditor1_Close);
			if (!IsPostBack)
			{
				ArrayList arr = new ArrayList();
				arr.Add(new TestItem(1));
				arr.Add(new TestItem(2));
				arr.Add(new TestItem(3));

				GridView1.DataSource = arr;
				GridView1.DataBind();
			}
		}


		protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			if (e.CommandName == "Select")
			{
				Session["ItemNumber"] = (int)GridView1.DataKeys[int.Parse(e.CommandArgument.ToString())].Value;
				mdlEditor.IsShowing = true;
				updEditor.Update();
			}
		}

		void ItemEditor1_Close(object sender, EventArgs e)
		{
			mdlEditor.IsShowing = false;
			updEditor.Update();
			updEditor2.Update();
		}

	}

	public class TestItem
	{
		private int m_intItemNumber;
		public int ItemNumber
		{
			get { return m_intItemNumber; }
			set { m_intItemNumber = value; }
		}

		public TestItem(int intItemNumber)
		{
			m_intItemNumber = intItemNumber;
		}
	}
}


ItemEditor.ascx
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ItemEditor.ascx.cs"
    Inherits="TestWebApplication.AurigmaTest.ItemEditor" %>
<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<%@ Register Src="ImageUploaderControl.ascx" TagName="ImageUploaderControl" TagPrefix="uc1" %>
<asp:HyperLink ID="lnkAddImage" runat="server" ToolTip="Add Image(s)" onclick="mdlAddImage.Show();"
    Text="Add Image" NavigateUrl="#">
</asp:HyperLink>
<br />
<br />
<asp:Button ID="btnClose" runat="server" CausesValidation="False" Text="Close" OnClick="btnClose_Click">
</asp:Button>
<ComponentArt:Dialog Modal="true" AllowDrag="true" Alignment="MiddleCentre" ID="mdlAddImage"
    runat="server" Height="500" Width="615">
    <Content>
        <asp:Panel ID="pnlContent" runat="server" Width="100%">
            <table cellpadding="8" cellspacing="0" width="100%">
                <tr onmousedown="mdlAddImage.StartDrag(event);">
                    <td>
                        <asp:Label ID="lblTitle" runat="server" Text="Add Images"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        <uc1:ImageUploaderControl ID="ImageUploaderControl1" runat="server" attachmenttype="ProductOption" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
    </Content>
    <Footer>
    </Footer>
</ComponentArt:Dialog>


ItemEditor.ascx.cs
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TestWebApplication.AurigmaTest
{
	public partial class ItemEditor : System.Web.UI.UserControl
	{

		public event EventHandler Close;

		protected virtual void OnClose(EventArgs e)
		{
			if (Close != null)
			{
				Close(this, e);
			}
		}

		protected void Page_Load(object sender, EventArgs e)
		{
		}

		protected void btnClose_Click(object sender, EventArgs e)
		{
			OnClose(e);
		}
	}
}


ImageUploaderControl.ascx
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ImageUploaderControl.ascx.cs" Inherits="TestWebApplication.AurigmaTest.ImageUploaderControl" %>
<%@ Register Assembly="Aurigma.ImageUploader" Namespace="Aurigma.ImageUploader" TagPrefix="cc1" %>

<script type="text/javascript">
    function ClientBeforeUpload() {
    }
</script>

<cc1:ImageUploader ID="ImageUploader1" name="ImageUploader1" runat="server" Height="400"
    LicenseKey="71060-4698C-00000-05AD1-8C271;72060-4698C-00000-00CD8-D244C" Width="600"
    OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="true" OnClientBeforeUpload="ClientBeforeUpload"
    ActiveXControlEnabled="false">
</cc1:ImageUploader>
<table width="100%">
    <tr>
        <td align="right">
            <input type="button" onclick="mdlAddImage.Close();" id="btnClose" value="Close" />
        </td>
    </tr>
</table>


ImageUploaderControl.ascx.cs
Code:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ImageUploaderControl.ascx.cs" Inherits="TestWebApplication.AurigmaTest.ImageUploaderControl" %>
<%@ Register Assembly="Aurigma.ImageUploader" Namespace="Aurigma.ImageUploader" TagPrefix="cc1" %>

<script type="text/javascript">
    function ClientBeforeUpload() {
    }
</script>

<cc1:ImageUploader ID="ImageUploader1" name="ImageUploader1" runat="server" Height="400"
    LicenseKey="71060-4698C-00000-05AD1-8C271;72060-4698C-00000-00CD8-D244C" Width="600"
    OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="true" OnClientBeforeUpload="ClientBeforeUpload"
    ActiveXControlEnabled="false">
</cc1:ImageUploader>
<table width="100%">
    <tr>
        <td align="right">
            <input type="button" onclick="mdlAddImage.Close();" id="btnClose" value="Close" />
        </td>
    </tr>
</table>

Scott Davis  
#2 Posted : Friday, February 12, 2010 2:40:29 AM(UTC)
Scott Davis

Rank: Member

Groups: Member
Joined: 2/12/2010(UTC)
Posts: 17

btw...I am using version 6.1.4.19258 of the control
andreym  
#3 Posted : Sunday, February 14, 2010 6:03:32 PM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Hi!

In the ImageUploaderControl.ascx file set Main.aspx value for the Action property for the ImageUploader1 control:

Code:

<cc1:ImageUploader ID="ImageUploader1" name="ImageUploader1" runat="server" Height="400"
    LicenseKey="71060-4698C-00000-05AD1-8C271;72060-4698C-00000-00CD8-D244C" Width="600"
    OnFileUploaded="ImageUploader1_FileUploaded" ShowDebugWindow="true" 
    OnClientBeforeUpload="ClientBeforeUpload"  ActiveXControlEnabled="false"
    Action="Main.aspx" >
</cc1:ImageUploader>
Scott Davis  
#4 Posted : Sunday, February 14, 2010 10:46:02 PM(UTC)
Scott Davis

Rank: Member

Groups: Member
Joined: 2/12/2010(UTC)
Posts: 17

Setting the Action property as you suggested did indeed fix the problem. The confusing thing is that the Action property's default value is supposed to be ".", which the docs say will cause the control to submit files to the same page it is hosted on. I'm just curious how setting the Action property explicitly works and leaving it at the default "." value does not?

I intend to use the ImageUploader control on a single UserControl which I will use in numerous places within my asp.net application. Taking your suggestion and applying it to my application I added the following line of code to the Page_Load method of my UserControl hosting the ImageUploader control:

Code:

ImageUploader1.Action = this.Request.Path;


This seemed to fix the problem within my application.
andreym  
#5 Posted : Tuesday, February 16, 2010 9:47:59 PM(UTC)
andreym

Rank: Advanced Member

Groups: Member
Joined: 6/16/2009(UTC)
Posts: 134

Was thanked: 8 time(s) in 8 post(s)
Hi!

The problem is when you open popup window it add "#" symbol to the page URL. Image Uploader confuse about it symbol and can't determine Action url properly. This problem exist in activex version only and will be fixed in next release.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.