Priya.InfoList.Views.TemplateInfoDetailSave.GetScriptFilled C# (CSharp) Method

GetScriptFilled() public method

public GetScriptFilled ( bool includeScriptTag, bool loadMinIfAvailable, bool validate, bool throwException, string &retMessage ) : string
includeScriptTag bool
loadMinIfAvailable bool
validate bool
throwException bool
retMessage string
return string
		public virtual string GetScriptFilled(bool includeScriptTag, bool loadMinIfAvailable, bool validate, bool throwException, out string retMessage)
        {
            string message = null;

			StringBuilder script = new StringBuilder();
			try
            {
				string scriptTemplate = GetScript(loadMinIfAvailable, validate, throwException, out message);

                if (includeScriptTag ==true)
                {
			        script.Append(ResourceUtil.ScriptMarkupStart);
                    script.Append(Environment.NewLine);
                }


				if ((string.IsNullOrEmpty(scriptTemplate) ==false) && ((validate ==false) || IsScriptValid(throwException, out message)))
				{
					scriptTemplate = scriptTemplate.Replace("/*!@ServiceUrl@*/", string.IsNullOrEmpty(ScriptServiceUrl)==false ? ScriptServiceUrl : "");

				}
					
				script.Append(scriptTemplate);
                if (includeScriptTag ==true)
                {
                    script.Append(Environment.NewLine);
			        script.Append(ResourceUtil.ScriptMarkupEnd);
                }

			}
			catch (Exception ex)
            {
                 message = "Error:" + ex.Message;
				if (throwException) throw;
            }
            retMessage = message;
			return script.ToString();   
		}

Usage Example

        private static string GetSaveScript()
        {
            string message;
            var templateSave = new TemplateInfoDetailSave
            {
                ScriptServiceUrl = UtilsGeneric.GetCurrentService(ServiceUrl)
            };

            string htmlScript = templateSave.GetScriptFilled(true, UtilsGeneric.LoadMinJs, UtilsGeneric.Validate, UtilsGeneric.ThrowException,
                                                                  out message);
            return htmlScript;
        }