需要帮助理解.cshtml页面中的Razor语法

时间:2022-07-15 19:44:59

I have got an already developed MVC 4 application and I have to fix some bugs in this project. I am facing a trouble regarding a syntax which are written like this in a .cshtml page . I am not getting any clue for what purpose this syntax is written and I am getting confused with the MVC Viewmodel concept.

我已经开发了一个MVC 4应用程序,我必须修复这个项目中的一些错误。关于在.cshtml页面中这样写的语法,我遇到了麻烦。我没有得到任何关于这种语法编写目的的线索,我对MVC Viewmodel概念感到困惑。

@Html.CheckBoxFor(m => m.RemoveImage) @PartnerNet.Resource.Client.ViewModel.RemoveLogo
<img src="@Url.Content("~/Content/Images/" + "no-logo.png")" alt="@PartnerNet.Resource.Client.ViewModel.NoLogo" />

if I refer the dll defination it is showing like this when I am exploring the dll.Please give some ideas.

如果我参考dll定义,当我正在探索dll时,它会显示为这样。请给出一些想法。

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;

namespace PartnerNet.Resource.Client
{
    [CompilerGenerated]
    [DebuggerNonUserCode]
    [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    public class ViewModel
    {
        public static string Address { get; }
        public static string AdminNotes { get; }
        public static string AlarmsActive { get; }
        public static string AlarmsHistory { get; }
        public static string AlarmStatus_1 { get; }
        public static string AlarmStatus_2 { get; }
        public static string AlarmStatus0 { get; }
        public static string AlarmStatus1 { get; }
        public static string AlarmStatus2 { get; }
        public static string AlarmStatus3 { get; }
        public static string AlarmStatus6 { get; }
        public static string AutoTreatment { get; }
        public static string AutoTreatmentCompletionStatus { get; }
        public static string AutoTreatmentLatest { get; }

1 个解决方案

#1


0  

@Html.CheckBoxFor(m => m.RemoveImage)@PartnerNet.Resource.Client.ViewModel.RemoveLogo

@ Html.CheckBoxFor(m => m.RemoveImage)@ PartnerNet.Resource.Client.ViewModel.RemoveLogo

It says it is creating a checkbox for your current viewmodel with the name called RemoveImage in your view model.

它表示它正在为您当前的viewmodel创建一个复选框,在视图模型中名为RemoveImage。

It then adds text from the PartnerNet resource file and then loads the actual image and adds the alt tag again from the resource file.

然后,它会从PartnerNet资源文件中添加文本,然后加载实际图像,并再次从资源文件中添加alt标记。

A resource file is an mvc settings type file where text based values can be stored - example their will be a value store for the removelogo entry.

资源文件是mvc设置类型文件,其中可以存储基于文本的值 - 例如,它们将是removelogo条目的值存储。

Hope that helps.

希望有所帮助。

#1


0  

@Html.CheckBoxFor(m => m.RemoveImage)@PartnerNet.Resource.Client.ViewModel.RemoveLogo

@ Html.CheckBoxFor(m => m.RemoveImage)@ PartnerNet.Resource.Client.ViewModel.RemoveLogo

It says it is creating a checkbox for your current viewmodel with the name called RemoveImage in your view model.

它表示它正在为您当前的viewmodel创建一个复选框,在视图模型中名为RemoveImage。

It then adds text from the PartnerNet resource file and then loads the actual image and adds the alt tag again from the resource file.

然后,它会从PartnerNet资源文件中添加文本,然后加载实际图像,并再次从资源文件中添加alt标记。

A resource file is an mvc settings type file where text based values can be stored - example their will be a value store for the removelogo entry.

资源文件是mvc设置类型文件,其中可以存储基于文本的值 - 例如,它们将是removelogo条目的值存储。

Hope that helps.

希望有所帮助。