Thursday, September 27, 2007

Registering a client script on a Sharepoint Custom Page

 

This a is a self memory post, because i know i ll need it again.

In this case i am creating a function to load a Flash Movie

Of course it is part of a ASP.Net Page developed with Visual Studio 2003

 

private void Page_PreRender(object sender, System.EventArgs e)
{

        scriptString += "function changeMovie(){";

        scriptString += "var d=document;";           

        if (Page.IsPostBack)
        {                            
            scriptString += "myflash='" + lblFlashnameValue.Value  + "&Hoja="+  lblIdHojaValue.Value +"';" ;
        }
        else
        {
            //First Time
            scriptString += "mypath='"  + Request.QueryString["TMCOrigen"]  +  "/_layouts/pages/';";
            scriptString += "mypathXML='"  + Request.QueryString["TMCOrigen"]  +  "/_layouts/pages/';";                   
            scriptString += "myflash=mypath+'tree20070921R.swf?SharepointTree='+ mypathXML + " + "'"+"tree99.xml"+"'" +";";           

        }

        scriptString += "d.all('tree20070921R').LoadMovie(0, myflash);";
        scriptString += "d.all.lblFlashnameValue.value =   myflash ;";           
        scriptString += "}";
        scriptString += "</script>";
        Page.RegisterClientScriptBlock("clientScript", scriptString);
}

0 Comments:

Post a Comment

<< Home