Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

Loading a flash object in an asp.net web application dynamicaly:

In the "code before" aspx file, create an html-object, for example, a <div>. This object needs to be inside an Updatepanel.
<asp:UpdatePanel runat="server" ChildrenAsTriggers="true" ID="ReviewAndSendUpdatePanel" UpdateMode="Conditional">
        <div id="flashdiv2">

In the code behind file use the System.Web.UI.ScriptManager object to insert the script into the HTML.

StringBuilder sbScript = new StringBuilder();
string flashFileName = "c:\myflash.swf"
string flashDivName = "flashdiv2"

sbScript.Append("var so = new SWFObject(\"" + flashFileName + "\", \"" + flashDivName +"\", \"540\", \"340\", \"8\", \"#FFFFFF\");");
sbScript.Append("so.write(\"" + flashDivName + "\");");

ScriptManager.RegisterStartupScript(ReviewAndSendUpdatePanel, ReviewAndSendUpdatePanel.GetType(), "reviewflash", sbScript.ToString(), true);

 © Evident Interactive BV