Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 687
  • Last Modified:

how can I rewrite this so I do not require dll ScriptHelper

ScriptHelper.RegisterStartupScript(this, GetType(), "closeSendDialog", ScriptHelper.GetScript("window.close();"));

how can I rewrite this so I do not require dll ScriptHelper
#region Assembly CMS.GlobalHelper.dll, v2.0.50727
// C:\inetpub\wwwroot\KenticoCMS\Bin\CMS.GlobalHelper.dll
#endregion

using System;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CMS.GlobalHelper
{
    // Summary:
    //     Methods for the script generating
    public static class ScriptHelper
    {
        // Summary:
        //     Script registration key for the dialog script
        public const string DIALOG_SCRIPT_KEY = "dialogScript";
        //
        // Summary:
        //     Edit document script key
        public const string EDIT_DOCUMENT_SCRIPT_KEY = "editDocumentScript";
        //
        // Summary:
        //     Script registration key for Lightbox
        public const string LIGHTBOX_KEY = "LightBox";
        //
        // Summary:
        //     Script registration key for the non modal win script
        public const string NEWWINDOW_SCRIPT_KEY = "newWindowScript";
        //
        // Summary:
        //     Prefix used for registering script files
        public const string SCRIPTFILE_PREFIX_KEY = "ScriptFile_";
        //
        // Summary:
        //     Script registration key for the editor toolbar
        public const string TOOLBAR_SCRIPT_KEY = "toolbarScript";
        //
        // Summary:
        //     Script registration key for cross-window scripting ("wopener")
        public const string WOPENER_SCRIPT_KEY = "wopenerScript";

        // Summary:
        //     If true, progress script is allowed on pages
        public static bool AllowProgressScript { get; set; }
        //
        // Summary:
        //     If true, automatic window title is enabled
        public static bool AllowTitleScript { get; set; }
        //
        // Summary:
        //     Capslock check script (OnCasplockOn and OnCapslockOff functions must be implemented)
        public static string CapslockScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string DialogScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string EditDocumentScript { get; set; }
        //
        // Summary:
        //     Script code for the dialog handling
        public static string NewWindowScript { get; set; }
        //
        // Summary:
        //     HTML Editor toolbar script
        public static string ToolbarScript { get; set; }
        //
        // Summary:
        //     Cross-window scripting script ("wopener")
        public static string WOpenerScript { get; set; }

        // Summary:
        //     Appends tooltip to control.
        //
        // Parameters:
        //   cntrl:
        //     Control
        //
        //   tooltipText:
        //     Tooltip
        //
        //   cursor:
        //     Mouse pointer
        public static void AppendTooltip(WebControl cntrl, string tooltipText, string cursor);
        //
        // Summary:
        //     Escapes the given HTML string for usage in the javascript string constant
        //
        // Parameters:
        //   text:
        //     Text to escape
        public static string EscapeHTMLString(string text);
        //
        // Summary:
        //     Escapes the given string for usage in the jQuery selectors. All meta-characters
        //     are escaped using '\'.
        //
        // Parameters:
        //   text:
        //     Text to escape.
        public static string EscapeJQueryCharacters(string text);
        //
        // Summary:
        //     Fixes common 'pendingCallbacks' javascript error
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void FixPendingCallbacks(Page page);
        //
        // Summary:
        //     Formats string to be used for tooltip
        //
        // Parameters:
        //   text:
        //     Tooltip string
        public static string FormatTooltipString(string text);
        //
        // Summary:
        //     Formats string to be used for tooltip
        //
        // Parameters:
        //   text:
        //     Tooltip string
        //
        //   encode:
        //     Indicates whether the tooltip text should be encoded
        public static string FormatTooltipString(string text, bool encode);
        //
        // Summary:
        //     Returns the javascript alert message
        //
        // Parameters:
        //   message:
        //     Message to display
        public static string GetAlertScript(string message);
        //
        // Summary:
        //     Returns the script to implement the specified code
        //
        // Parameters:
        //   url:
        //     URL of the script file
        public static string GetIncludeScript(string url);
        //
        // Summary:
        //     Returns javascript for page redirection.
        //
        // Parameters:
        //   url:
        //     Page url the user should be redirected to.
        //
        //   newWindowInCMSDesk:
        //     TREU - requested page should be opened in a new window when user is in CMSDesk,
        //     otherwise it is redirected to the requsted page in current window.
        public static string GetRedirectScript(string url, bool newWindowInCMSDesk);
        //
        // Summary:
        //     Returns the script to implement the specified code
        //
        // Parameters:
        //   script:
        //     Script to add
        public static string GetScript(string script);
        //
        // Summary:
        //     Encodes text to be used in javascript string and encapsulates it with "'"
        //
        // Parameters:
        //   text:
        //     Text to be encoded
        public static string GetString(string text);
        //
        // Summary:
        //     Encodes text to be used in javascript string and optionally encapsulates
        //     it with "'"
        //
        // Parameters:
        //   text:
        //     Text to be encoded
        //
        //   encapsulate:
        //     If true, text is encapsulated it with "'"
        public static string GetString(string text, bool encapsulate);
        //
        // Summary:
        //     Gets the script for the automatic window title
        //
        // Parameters:
        //   titlePart:
        //     Part of the window title
        public static string GetTitleScript(string titlePart);
        //
        // Summary:
        //     Returns true if the client script block is already registered
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   key:
        //     Key
        public static bool IsClientScriptBlockRegistered(Control control, string key);
        //
        // Summary:
        //     Returns true if the client script block is already registered
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   key:
        //     Key
        public static bool IsClientScriptBlockRegistered(Page page, string key);
        //
        // Summary:
        //     Determines whether Lightbox is already registered
        //
        // Parameters:
        //   page:
        //     Page to examine
        //
        // Returns:
        //     TRUE if Lightbox is already registered
        public static bool IsLightBoxRegistered(Page page);
        //
        // Summary:
        //     Determines whether MooTools library is already registered
        //
        // Parameters:
        //   page:
        //     Page to examine
        //
        // Returns:
        //     TRUE if MooTools library is already registered
        public static bool IsMooToolsRegistered(Page page);
        //
        // Summary:
        //     Ensures registration of the application constants script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterApplicationConstants(Page page);
        //
        // Summary:
        //     Ensures registration of the array declaration script
        //
        // Parameters:
        //   control:
        //     Control to register
        //
        //   arrayName:
        //     Name of the array to register
        //
        //   arrayValue:
        //     Value of the array to register
        public static void RegisterArrayDeclaration(Control control, string arrayName, string arrayValue);
        //
        // Summary:
        //     Ensures registration of the array declaration script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   arrayName:
        //     Name of the array to register
        //
        //   arrayValue:
        //     Value of the array to register
        public static void RegisterArrayDeclaration(Page page, string arrayName, string arrayValue);
        //
        // Summary:
        //     Registers the client script block
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterClientScriptBlock(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the client script block
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterClientScriptBlock(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Registers the client script include
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   url:
        //     Script URL
        public static void RegisterClientScriptInclude(Control control, Type type, string key, string url);
        //
        // Summary:
        //     Registers the client script include
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   url:
        //     Script URL
        public static void RegisterClientScriptInclude(Page page, Type type, string key, string url);
        //
        // Summary:
        //     Ensures registration of the main CMS script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterCMS(Page page);
        //
        // Summary:
        //     Registeres the script which checks the page completeness on postback
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterCompletePageScript(Page page);
        //
        // Summary:
        //     Registeres the script for modal dialogs
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterDialogScript(Page page);
        //
        // Summary:
        //     Ensures registration of script which causes correct resizing of uni flat
        //     selectors
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterFlatResize(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQuery(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery dropshadow JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQueryShadow(Page page);
        //
        // Summary:
        //     Ensures registration of jQuery tooltips JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterJQueryTooltips(Page page);
        //
        // Summary:
        //     Ensures registration of all necessary JavaScript libraries for Lightbox functionality
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   target:
        //     Target control
        public static void RegisterLightbox(Page page, Control target);
        //
        // Summary:
        //     Ensures registration of all necessary JavaScript libraries for Lightbox functionality
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   target:
        //     Target control
        //
        //   group:
        //     Lightbox group name
        public static void RegisterLightbox(Page page, Control target, string group);
        //
        // Summary:
        //     Ensures registration of MooTools JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterMooTools(Page page);
        //
        // Summary:
        //     Registers the form submit statement
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterOnSubmitStatement(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the form submit statement
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterOnSubmitStatement(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Ensures registration of the progress script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterProgress(Page page);
        //
        // Summary:
        //     Ensures registration of Prototype JavaScript framework
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterPrototype(Page page);
        //
        // Summary:
        //     Ensures registration of the save changes notification script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSaveChanges(Page page);
        //
        // Summary:
        //     Ensures registration of Scriptaculous (script.aculo.us) JavaScript library
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   load:
        //     Comma-separated values.  The scripts that can be specified are: builder,
        //     effects, dragdrop, controls, slider
        public static void RegisterScriptaculous(Page page, string load);
        //
        // Summary:
        //     Ensures registration of the main CMS script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   scriptFile:
        //     Script file name to register
        public static void RegisterScriptFile(Page page, string scriptFile);
        //
        // Summary:
        //     Ensures registration of the shortcuts script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterShortcuts(Page page);
        //
        // Summary:
        //     Registers Silverlight's support script (http://code.msdn.microsoft.com/silverlightjs)
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSilverlight(Page page);
        //
        // Summary:
        //     Ensures registration of SKMenu JavaScript support
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSKMenu(Page page);
        //
        // Summary:
        //     Ensures registration of SKMenu JavaScript support
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   path:
        //     Relaitve path
        public static void RegisterSKMenu(Page page, string path);
        //
        // Summary:
        //     Ensures registration of the spellchecker script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterSpellChecker(Page page);
        //
        // Summary:
        //     Registers the startup script
        //
        // Parameters:
        //   control:
        //     Control
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterStartupScript(Control control, Type type, string key, string script);
        //
        // Summary:
        //     Registers the startup script
        //
        // Parameters:
        //   page:
        //     Page
        //
        //   type:
        //     Type
        //
        //   key:
        //     Key
        //
        //   script:
        //     Script
        public static void RegisterStartupScript(Page page, Type type, string key, string script);
        //
        // Summary:
        //     Ensures registration of atuomatic window title script
        //
        // Parameters:
        //   page:
        //     Page to register
        //
        //   titlePart:
        //     Part of the window title
        public static void RegisterTitleScript(Page page, string titlePart);
        //
        // Summary:
        //     Ensures registration of tool tip script
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterTooltip(Page page);
        //
        // Summary:
        //     Registeres the script which checks the page completeness on postback
        //
        // Parameters:
        //   page:
        //     Page to register
        public static void RegisterWOpenerScript(Page page);
    }
}

Open in new window

0
omegalove
Asked:
omegalove
2 Solutions
 
Meir RivkinFull stack Software EngineerCommented:
u can use Reflector to get the code source behind ScriptHelper (http://www.red-gate.com/products/reflector/)
0
 
guru_samiCommented:
for that particular case try this.:

Page.ClientScript.RegisterStartupScript(this.GetType(), "closeSendDialog", "window.close();",true);
0
 
omegaloveAuthor Commented:
not sure what is the problem here. Can someone help me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now