Bug with Silverlight control inserted in codebehind

  1. #1

    Bug with Silverlight control inserted in codebehind

    Hello All,

    I have some problem, and may be its bug, or, may be not :)
    I'm trying to use in my project Silverlight File Upload control ( http://silverlightfileupld.codeplex.com/ ).
    I have button, handler for this button which display window, and control is inserted inside code for window.
    Control is inserted using ContentControls.Add() method.
    And here happens something strange. In IE - it works fine. In Chrome, FF, Safari - Silverlight is not shown at all.
    I tried to put control in container, in panel, without success. Same think happens if i use page-based user control,
    with <object> tag inside for SL loading.

    Here is a code :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    using DC.SilverlightFileUpload;
    using System.Web.UI.SilverlightControls;
    
    namespace WebApplication2
    {
    
        public class SLWindow : Ext.Net.Window
        {
            public DC.SilverlightFileUpload.MultiFileUploadControl control;
            public SLWindow()
            {
                this.ID = "id_wnd_upload";
                this.Width = 650;
                this.Height = 400;
                this.Title = "Upload";
                this.Resizable = false;
                this.Modal = true;
                this.Hidden = true;
    
                this.DirectEvents.Hide.Event += this.handleClose;
                control = new DC.SilverlightFileUpload.MultiFileUploadControl { ID = "id_sc3", UploadPage = "~/Handler1.ashx", Width = 640, Height = 350, JavascriptCompleteFunction = "DM.Test" };
    
                Ext.Net.Container cont = new Container { ID = "id_cnt1", Width=600, Height=400 };
                cont.ContentControls.Add(new System.Web.UI.SilverlightControls.Silverlight { ID = "id_sl1", Width = 640, Height = 350, Source = "ClientBin/FileUpload.xap" });
                //cont.ContentControls.Add(control);
                this.Add(cont);
    
            }
    
            public void handleClose(object sender, DirectEventArgs args)
            {
                return;
            }
        }
    
        public partial class _Default : System.Web.UI.Page
        {
            SLWindow wnd;
    
            protected void Page_Load(object sender, EventArgs e)
            {
                Button2.DirectEvents.Click.Event += AddNewPanel_2;
            }
            
    
            protected override void OnInit(EventArgs e)
            {
    
                id_container.Controls.Add(new System.Web.UI.ScriptManager { ID = "id_sc1" });
                wnd = new SLWindow();
                this.form1.Controls.Add(wnd);
    
                base.OnInit(e);
            }
    
            
            protected void AddNewPanel_2(object sender, DirectEventArgs e)
            {
                wnd.Hidden = false;
                wnd.ShowModal();
            }
    
            [DirectMethod]
            public void Test()
            {
                wnd.Hide();
                Ext.Net.X.Msg.Show(new MessageBoxConfig { Title = "Submit", Message = "Files submited", Icon = MessageBox.Icon.INFO, Buttons = MessageBox.Button.OK });
                return;
            }
        }
    }
    May be, and i'm sure that this code is not enough. So, i'm sending also whole project on this link :
    http://decho.ath.cx/pavel/WebApplication_Test.zip

    Same think, done in clean asp page, without Ext - work on all browser. Also can send link with working test project with this case.

    Does any have idea how this can be solved?
  2. #2
    Update : if i set AutoLoad.Mode = IFrame
    then control will be displayed , but not in window.
    Also tried to put it inside asp.PanelHolder, inside FitLayout, without any success.
  3. #3
    Hi,

    When I run the page under FF, I see
    Sys.InvalidOperationException: InitializeError error #2104 in control 'id_sc3': 2104 Error occurs.
    in the FireBug console.

    I guess the problem is related to that error.

    I'd recommend you to look this error up on the internet or ask on a specialized forum.

    I think it's not an Ext.Net issue.

Similar Threads

  1. Positioning control from codebehind
    By cuki in forum 1.x Help
    Replies: 1
    Last Post: Apr 06, 2012, 3:17 PM
  2. SilverLight in Window and TabPanel
    By Tom Zhang in forum 1.x Help
    Replies: 3
    Last Post: Nov 02, 2011, 9:54 AM
  3. [CLOSED] Silverlight and Coolite Tabs (v0.8.2.983)
    By niceguymattx in forum 1.x Legacy Premium Help
    Replies: 14
    Last Post: Nov 22, 2010, 11:50 AM
  4. Silverlight and EXT... Loading Issue...
    By bugs in forum 1.x Help
    Replies: 4
    Last Post: Sep 30, 2010, 6:17 PM
  5. Replies: 2
    Last Post: May 15, 2009, 9:10 PM

Tags for this Thread

Posting Permissions