/// <summary> /// Creates inline Script Resource, that will be rendered in the Header /// </summary> /// <param name="code"></param> /// <returns></returns> public static HtmlResource RegisterPageScript(string code) { var s = new HtmlScriptResource(); s.Code = code; return(s); }
/// <summary> /// Creates JavaScript Variable with Provided name for Model /// </summary> /// <param name="name"></param> /// <param name="model"></param> /// <returns></returns> public static HtmlResource RegisterPageScriptModel(string name, object model) { var s = new HtmlScriptResource(); AtomJavaScriptSerializer js = new AtomJavaScriptSerializer(null); s.Code = "var " + name + " = " + js.Serialize(model) + ";"; return(s); }