UnpackScript() public static method

Returns a string representation of the specified embedded script file. The script is wrapped with script start and end tags and assumes the script language is "vbscript" if the file extension is ".vbs" and "javascript" otherwise.
Using a naming convention, all scripts are placed in the Resources\Scripts folder. The ScriptName should just be the filename of the script. For example, if you embed a file at the following location "Resources\Scripts\MyScript.js", the ScriptName to pass is "MyScript.js".
public static UnpackScript ( string scriptName ) : string
scriptName string FileName of the script. Just the file name.
return string
 void RegisterClientScript()
 {
     if (Page.ClientScript.IsClientScriptBlockRegistered(ClientScriptKey))
     {
         Type cstype = GetType();
         Page.ClientScript.RegisterClientScriptBlock(cstype, ClientScriptKey,
                                                     ScriptHelper.UnpackScript("CollapsiblePanel.js"));
     }
 }
Example #2
0
 /// <summary>
 /// Sends server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter"/> object, which writes the content to
 /// be rendered on
 /// the client.
 /// </summary>
 /// <param name="writer">The <see langword="HtmlTextWriter"/> object that receives the server control content.</param>
 protected override void Render(HtmlTextWriter writer)
 {
     writer.Write(string.Format(CultureInfo.InvariantCulture, ScriptHelper.UnpackScript("CoCommentScript.js"),
                                BlogTool, BlogUrl, BlogTitle, PostTitle, PostUrl, CommentAuthorFieldName,
                                CommentTextFieldName, CommentButtonId, CommentFormId));
 }