问题标签 [razorgenerator]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
315 浏览

c# - Entity Framework、Razor、DB first:更改用于外键下拉文本的列

我正在使用 Razor 控制器建立一个简单的网络,用作内部 GUI,用于与我们的数据库的某些部分进行交互。在大多数情况下,这很顺利,但是当涉及到外键时,显然引用表的第一列(按字母顺序排序时)成为默认表示(即编辑时下拉框中显示的内容)。

例如,我有一个Campaigns表,它有一个外键CompaniesCompanies.Name我想在显示时使用一列Campaigns.CompanyId。然而,Razor 显然自动选择了第一个可用的,使用Companies.AccessKey(这很难理解)来代表公司。

我正在寻找某种方法来指定哪些列用于表示一行,希望不会更改自动生成的文件。

这让我发疯,虽然我认为这是一个常见问题,但出于某种原因,我的谷歌搜索并没有找到任何答案:(

0 投票
0 回答
100 浏览

c# - 示例应用程序 RazorGenerator 中的错误

我正在尝试查看此页面github的示例。它指的是主题

但是,我的 VS 返回我无法解决的错误。

项目:LibraryViewProject

  • Failed to download package correctly. The contents of the package could not be verified.
  • The command ""H:\master\.nuget\nuget.exe" install "H:\master\LibraryViewProject\packages.config" -source "" -o> "H:\master\packages"" exited with code 1

项目:MvcApplicationRazorGeneratorSeparateLibrary

  • Failed to download package correctly. The contents of the package could not be verified.
  • The command ""H:\master\.nuget\nuget.exe" install "H:\master\MvcApplicationRazorGeneratorSeparateLibrary\packages.config" -source "" -o "H:\master\packages"" exited with code 1.

PS:我使用的是VS2013。

0 投票
1 回答
293 浏览

c# - RedirectToRouteResult 可以与 RazorGenerator.Mvc 一起使用吗?

我有一个在 MVC5 .Net 4.5.2 中有一些视图的项目然后我在解决方案中添加了第二个 MVC 项目,它使用 razorgenerator nuget 包来预编译视图以便在第一个项目中使用。接下来,我使用添加到 GlobalFilters 的自定义 GlobalFilterCollection 将用户引导至第一个项目中的视图或第二个项目中的特定视图。

当在 VS2013 (IIS Express) 中本地运行时,此方案效果很好。但是,当我将它放在服务器上(Win server 2008,IIS7)时,它在被 javascript 调用时找不到视图,只有最初调用的视图。

有任何想法吗?

定义的路线:

使用的过滤器:

调用 Javascript 以请求在 IIS 上失败的后续视图:

0 投票
0 回答
75 浏览

c# - 在 RazorEngine 中将 @ 更改为 $

我们可以在razormachine中将 @ 更改为 $ 因为我的模板将包含很多 @

0 投票
0 回答
407 浏览

c# - 如何在外部程序集中定义 MVC 共享 EditorTemplate?

我正在尝试在我的 MVC 应用程序中重用共享模板。为此,我使用 Razor Generator VS Extension 并将 RazorGenerator 设置为我的 *.cshtml 文件的自定义工具。在我的解决方案中,我创建了另一个 MVC 项目(如http://razorgenerator.codeplex.com/中所述),并在其中的 Views/Shared/EditorTemplates 下定义了一个 String.cshtml 模板。

在我实际的 MVC 应用程序中,我添加了对该项目的引用,并在视图中尝试执行以下操作:

(FeedName 是字符串类型)。但是,String.cshtml 没有被拾取。

我尝试将 String.cshtml 的自定义工具命名空间设置为使用与实际应用程序相同的命名空间,以查看是否有帮助,但没有。

那么,我怎样才能告诉引擎从另一个程序集中获取编辑器模板呢?

0 投票
1 回答
1444 浏览

asp.net-mvc - Setting value for a textbox MVC 4 ASP

I have the following code in my view .cshtml

and i want to set a value that comes from the controller, the value is from the class Comida the property Price,

¿What can i do to set the value menu.Price to my input class="plato" value="" id="TComida" without losing the css styles aplied thx to my class="plato"?

I have checked that the object menu is correctly populated with data from the controller. Sorry for my english and thx in advance.

0 投票
1 回答
159 浏览

.net - RazorGenerator 不生成表单标记

谁能告诉我这里可能发生了什么?我有两个项目,都使用 RazorMVC,并且都在 .cshtml 文件中使用相同的代码,但一个不输出<form>标签:

在非功能版本中,这是输出:

帮助!:)

0 投票
1 回答
825 浏览

powershell - Powershell 和 Razor 模板

我正在使用 PowerShell 和Render-RazorTemplate.ps1创建一个 html 页面

我有一个“System.Collections.Hashtable”传递给我的模型,但我没有让它工作

如果我这样使用

我有一个错误

如果我从属性类内部删除@(s["Icon"])它会起作用并向我显示值

有人对此有任何想法吗?

0 投票
2 回答
1382 浏览

c# - Override view in ASP.NET MVC site not working

I have a separate project in my solution that contains some Controllers and compiled views. I use those controllers for base classes to other controllers in my MVC application and the views are compiled using RazorGenerator.

Lets say B is Base Controller with non abstract action method SomeAction that returns View("_MyView"). _MyView.cshtml is compiled using RazorGenerator.

Lets say controller A inherits B but doesn't override SomeAction.

I've tried to make another view "~/Views/A/_MyView.cshtml" to override the default one, but it doesn't work. My question is how can I accomplish this?

ADDITIONAL INFO

1) I know that the views by default are searched in that order in those paths

2) Putting "~/Views/Shared/_MyView.cshtml" does override the view, but not only for controller A, but also for every other controller that inherits B

3) Overriding SomeAction to return base.SomeAction() doesn't work

UPDATE

I have found similar question here, but doing the suggestion nothing happened RazorGenerator Issues

I have posted my own issue here

Thank you in advance!

0 投票
1 回答
2705 浏览

asp.net - RazorGenerator 未生成正确的命名空间

我们正在为我们的项目使用 RazorGenerator。当我编辑视图时,生成的文件的名称空间更改为ASP,而不是 RazorGenerator 的默认名称,它应该是文件夹结构。我们没有更改 RazorGenerator 的任何设置(甚至不确定是否有设置),所以我不确定发生了什么,因为这只发生在我的机器上。我已经卸载/安装了该工具,但同样的事情发生了。有人对此有解决方案吗?谢谢!