razorengine

RazorEngine string layouts and sections?

≯℡__Kan透↙ 提交于 2019-12-29 14:19:44
问题 I use razor engine like this: public class EmailService : IService { private readonly ITemplateService templateService; public EmailService(ITemplateService templateService) { if (templateService == null) { throw new ArgumentNullException("templateService"); } this.templateService = templateService; } public string GetEmailTemplate(string templateName) { if (templateName == null) { throw new ArgumentNullException("templateName"); } Assembly assembly = Assembly.GetAssembly(typeof(EmailTemplate

csv export showing HTML tags in the CSV file and only shows one record

隐身守侯 提交于 2019-12-25 04:26:27
问题 I would be very grateful if you could help me out with the following code.. I can read a local .xls file and show it on the browser using jQuery jTable, I can also export the data to .csv file but for some reason it is showing HTML tags in the downloaded file, which I believe is due to using HtmlTextWriter tw = new HtmlTextWriter(sw); gridvw.RenderControl(tw); Also, it only shows one record when downloaded the .CSV file.. I tried using TextWriter but doesn't show anything. public ActionResult

Request action aborted on MFE proxy, SMTP server is not available

╄→尐↘猪︶ㄣ 提交于 2019-12-25 02:34:07
问题 Thanks for helping me out when I was stuck in doing something at one time or the other. I posted a question previously about extracting email contacts from an email address; I got help, but the problem is that I need to send email to the extracted emails using the google smtp server(smtp.gmail.com, 587). When I try to send email, I receive this message "Error in processing. The server response was: Request action aborted on MFE proxy, SMTP server is not available" What should I do? 回答1: I had

Formatting nullable decimal in RazorEngine

梦想与她 提交于 2019-12-25 02:04:01
问题 RazorEngine.dll version is 3.2. Example code inside a razor engine template (cshtml file) : @foreach(var row in Model.Trades) { <tr> <td> @string.Format("{0:N2}",row.Amount) </td> </tr> } where row.Amount is defined in the Trades class as : public decimal? Amount; The stack trace fromRazorEngine is : > System.ArgumentNullException was caught HResult=-2147467261 > Message=Value cannot be null. Parameter name: args Source=mscorlib > ParamName=args StackTrace: > at System.String.Format(String

404.15 not found MVC4 RazorJS

五迷三道 提交于 2019-12-24 03:12:53
问题 I'm using RazorJS in my MVC4 application for using the Razor syntax "@" in the Js file. //Code: @Html.RazorJSInclude("~/Scripts/Application/Transactions.js") <button id="btnSearch" name="submit" type="button" onclick="Loadgrid();">Search</button> The "Transaction.js" has "LoadGrid" mehtod inside. When i use my Transaction.js as the above code it throws me error as "No such method(Loadgrid) is found". The rendered HTML in the browser shows like, <SCRIPT src="/razorjs.axd?fn=/Scripts

RazorEngine and Visual Studio 2015 IntelliSense

老子叫甜甜 提交于 2019-12-22 10:23:12
问题 This post is not about ASP.NET MVC. I am using RazorEngine for template processing available here: https://antaris.github.io/RazorEngine/ The documentation states that I can have IntelliSense if I follow the instructions below: https://antaris.github.io/RazorEngine/IntellisenseAndResharper.html However, VS shows the following error: The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?) Also the following errors: The type or

A DbContext instance cannot be used inside OnConfiguring since it is still being configured at this point

喜夏-厌秋 提交于 2019-12-22 06:09:29
问题 I'm trying to build a custom view location system. public class myViewLocationExpander : IViewLocationExpander { private myDBContext _context; public myViewLocationExpander (myDBContext context) { _context = context; } public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations) { _context.Property.//..... //Error happened here Some other codes } And in my startup file public void ConfigureServices(IServiceCollection services) { /

ViewBag and HtmlHelper errors : “One or more types required to compile a dynamic expression cannot be found. Are you missing an assembly reference?”

佐手、 提交于 2019-12-22 04:35:45
问题 ViewBag error: "One or more types required to compile a dynamic expression cannot be found. Are you missing an assembly reference?" All HTML Helper methods contain the error: "The type argument for method cannot be inferred from usage. Try specifying the type arguments explicitly." After spending the last two days digging through other posts related to this error, here is what I've tried: Repairing Visual Studio Re-installing Visual Studio Making sure I have Microsoft.CSharp and System.Core

RazorEngine Error trying to send email

一个人想着一个人 提交于 2019-12-22 04:04:27
问题 I have an MVC 4 application that sends out multiple emails. For example, I have an email template for submitting an order, a template for cancelling an order, etc... I have an Email Service with multiple methods. My controller calls the Send method which looks like this: public virtual void Send(List<string> recipients, string subject, string template, object data) { ... string html = GetContent(template, data); ... } The Send method calls GetContent , which is the method causing the problem:

RazorEngine un-cache compiled templates

十年热恋 提交于 2019-12-21 07:16:31
问题 Currently, I am using RazorEngine v2.1 as part of a background process that sends templated emails (thousands of them). To speed things up, the templates are compiled with their md5 sum as a name. This makes it so that when a template is changed, it is re-compiled and all emails using the template are able to use the same compiled template. I keep track of the names of the compiled templates in a list so that I know when to call compile again (and do a few other things). The problem : It has