razorengine

Using Internal Properties in RazorEngine

吃可爱长大的小学妹 提交于 2021-01-27 03:55:36
问题 Our domain model properties are all "Internal" to protect the BDD approach we have taken. I really like making everything internal. Recently I am trying to get the RazorEngine to process a template using one of these domain models with internal members. When it compiles, I get the error: .Attendee.FirstName' is inaccessible due to its protection level I tried adding this line [assembly: InternalsVisibleTo("RazorEngine")] to the AssemblyInfo.cs of my domain model, but it doesnt seem to help.

Using Internal Properties in RazorEngine

六月ゝ 毕业季﹏ 提交于 2021-01-27 03:54:37
问题 Our domain model properties are all "Internal" to protect the BDD approach we have taken. I really like making everything internal. Recently I am trying to get the RazorEngine to process a template using one of these domain models with internal members. When it compiles, I get the error: .Attendee.FirstName' is inaccessible due to its protection level I tried adding this line [assembly: InternalsVisibleTo("RazorEngine")] to the AssemblyInfo.cs of my domain model, but it doesnt seem to help.

Using Internal Properties in RazorEngine

吃可爱长大的小学妹 提交于 2021-01-27 03:53:03
问题 Our domain model properties are all "Internal" to protect the BDD approach we have taken. I really like making everything internal. Recently I am trying to get the RazorEngine to process a template using one of these domain models with internal members. When it compiles, I get the error: .Attendee.FirstName' is inaccessible due to its protection level I tried adding this line [assembly: InternalsVisibleTo("RazorEngine")] to the AssemblyInfo.cs of my domain model, but it doesnt seem to help.

Is it possible to use a conditional construct to enable an attribute in Blazor?

岁酱吖の 提交于 2020-08-10 20:20:06
问题 Consider the following Razor component. @code { private bool isIndex = true; } @if (isIndex) { <NavLink href="" Match=NavLinkMatch.All> Index </NavLink> } else { <NavLink href="Other"> Other </NavLink> } Is it possible to use a conditional construct to enable Match=NavLinkMatch.All that renders the same output as above? <NavLink href=@(isIndex? string.Empty:"Other")> @(isIndex? "Index": "Other") </NavLink> 回答1: Is it possible to use a conditional construct to enable Match=NavLinkMatch.All It

add item to c# list on selectchange loaded through cascading

五迷三道 提交于 2020-06-29 04:28:26
问题 i have selectList with multiple attr which is filled through cascading(on select a company i just show selected Company Models) Now i want to allow user to select multiple models such that on select, item should add in c# list and display in page and then allow user to select more of any other company.Picture attached Following is my code. OrderViewModel public class OrderViewModel { [Display(Name ="Order ID")] public int order_id { get; set; } [Required] public string cus_name { get; set; }

.NET Core <select> With Default Value?

本秂侑毒 提交于 2020-05-09 02:20:08
问题 My goal is to generate a <select> dropdown with a certain select value ( <option> ) pre-selected , so the finalized HTML should look like this: <select> <option value = "1">Option1</option> <option value = "2" selected>Option2</option> <option value = "3">Option3</option> </select> Note that the option with a value of 2 has a selected attribute, indicating that it will show before the dropdown is clicked. I cannot (and am trying to) achieve this using .NET Core Tag Helpers. This is my model

System.StackOverflowException after HttpPost returning view - asp mvc

放肆的年华 提交于 2020-02-25 07:05:08
问题 The error that I get is this (no more info) : System.StackOverflowException Everything in my project is working fine but as soon as I post a data and after that, it should return view I get that error and in my layout as soon as I remove the part it working fine @Html.Action("TuorMenu", "Home", new { area = "Site" }) simplify layout @{ Layout = null; } <!DOCTYPE html> html dir="rtl" lang="fa"> <head> </head> <body> @Html.Action("TuorMenu", "Home", new { area = "Site" }) @RenderBody() </body>

How to render ModelMetadata object using Html.Displar in Razor-engine in ASP.NET MVC app?

南笙酒味 提交于 2020-01-23 10:50:47
问题 I am trying to utilize the DisplayTemplates feature in razor-engine to automate rendering my display views. I scan my Model to find the correct ModelMetadata for each property that I want to display. But I am not able to render the properties using Html.DisplayFor correctly. I tried to display my property like so // First I find the ModelMetadata for the property // I call this statement in a loop and each iteration I pass a different PropertyName to get the correct model ModelMetadata

RazorEngine using anonymous objects RuntimeBinderException

不羁的心 提交于 2020-01-14 06:45:41
问题 I'm using RazorEngine in a templating solution. I have to use anonymous objects for my model data. The code: string template = @" Name: @Model.name @foreach(var person in @Model.People) { <row> <column header=""Name"" width=""5cm"">@person.Name</column> <column header=""Age"" width=""5cm"">@person.Age</column> </row> }"; var personList = new List<object>(); personList.Add(new { Name = "Bob", Age = 25 }); personList.Add(new { Name = "Peter", Age = 30 }); var model = new { name = "Henry",

Emitting an HTML string from anonymous type property in a repeated, dynamically-typed Partial View

拜拜、爱过 提交于 2019-12-31 03:45:17
问题 I am passing an anonymous type into a dynamic partial view as part of the @model , and one of the properties is a string that contains some HTML. When I use the HtmlHelper methods to render the property, the Razor engine is encoding the string, resulting in literal text on the page - <i>text</i> in this case, instead of the desired text . Since it is a dynamically typed View, I cannot call the property directly. Specifically, if I try to bind to @Model.MyField , I get a