Oct 05, 2011, 10:17 AM
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 :
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?
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?