GetScript() 개인적인 메소드

private GetScript ( ) : string
리턴 string
예제 #1
0
파일: CsJsView.cs 프로젝트: joshperry/stuff
        public virtual void Render(ViewContext viewContext, System.IO.TextWriter writer)
        {
            // We'll be writing out javascript
            viewContext.HttpContext.Response.ContentType = "text/javascript";

            // Wrap the code in a try/catch just to signal errors
            writer.WriteLine("try {");

            // Have the derived view render it's script into the context
            // then render it to the output stream
            var ctx = new CsJsViewContext(viewContext);
            Render(ctx);
            writer.Write(ctx.GetScript());

            // Close the script try/catch
            writer.Write("} catch(error) { alert('csjs error'); }");
        }
예제 #2
0
        public virtual void Render(ViewContext viewContext, System.IO.TextWriter writer)
        {
            // We'll be writing out javascript
            viewContext.HttpContext.Response.ContentType = "text/javascript";

            // Wrap the code in a try/catch just to signal errors
            writer.WriteLine("try {");

            // Have the derived view render it's script into the context
            // then render it to the output stream
            var ctx = new CsJsViewContext(viewContext);

            Render(ctx);
            writer.Write(ctx.GetScript());

            // Close the script try/catch
            writer.Write("} catch(error) { alert('csjs error'); }");
        }