public RenderClientTemplate ( string razorTemplate ) : string | ||
razorTemplate | string | |
Результат | string |
public void ProcessRequest(HttpContextBase context) { var template = context.Request["template"]; var category = context.Request["category"]; var function = context.Request["function"]; if (string.IsNullOrWhiteSpace(template)) { context.Response.StatusCode = (int)HttpStatusCode.BadRequest; context.Response.StatusDescription = "Invalid template path"; return; } if (string.IsNullOrWhiteSpace(function)) { function = template; } context.Response.Clear(); context.Response.ContentType = "text/javascript"; using (var stream = GetRazorTemplateStream(context, template, category)) { context.Response.Output.Write(function + " = "); _templateEngine.RenderClientTemplate(stream, context.Response.Output); } }
public static IHtmlString ClientTemplate(this HtmlHelper html, string templateName) { var buffer = new StringWriter(); using (var reader = GetPartialViewStream(html.ViewContext, templateName)) TemplateEngine.RenderClientTemplate(reader, buffer); return(new HtmlString(buffer.GetStringBuilder().ToString())); }