我发现了一个线程:突出显示在Visual Studio 2010中杀死了我的Razor语法,询问并解释了如何关闭Razors代码的突出显示.
问题是,我导航到:Tools -> Options -> Environment -> Fonts and Colors但剃刀选项不存在!
我确信我可以习惯它,但它相当分散注意力,因为我对MVC还很新.
这是我的选择:

(图片并没有像我想象的那样清晰,但Razor选项不存在!)
c# model-view-controller asp.net-mvc razor visual-studio-2013
我正在为索引页面制作一个小表单.
@model MarketPlace.Models.Download
@{
ViewBag.Title = "Index";
}
@using (Html.BeginForm("Index", "Downloads", System.Web.Mvc.FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<td>@Html.DisplayNameFor(model => model.EMail)</td>
<td>@Html.TextBoxFor(model => model.EMail, new { @class = "form-control round-input", @style = "width:200px" })</td>
<td>@Html.DisplayNameFor(model => model.Reference)</td>
<td>@Html.TextBoxFor(model => model.Reference, new {@class = "form-control round-input", @style = "width:200px"})</td>
<td>@Html.DisplayNameFor(model => model.Products)</td>
<td>@Html.Buttonorsomething
}
Run Code Online (Sandbox Code Playgroud)
我以为会有一个`@Html.Button或其他东西,我在Google上搜索,但显然他们没有添加一个.
我的问题是,我该如何制作一个按钮?
编辑:请注意,我一直在使用ASP.NET MVC很短的时间,请原谅我这个愚蠢的问题!
我需要制定一个计划,计算出你工作时间会得到的金额.这是代码:
unit HoursWorked_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Spin;
type
TForm1 = class(TForm)
lblName: TLabel;
edtName: TEdit;
Label1: TLabel;
sedHours: TSpinEdit;
btncalc: TButton;
Panel1: TPanel;
lblOutput: TLabel;
Label2: TLabel;
Panel2: TPanel;
lblOutPutMonth: TLabel;
labelrandom: TLabel;
Label3: TLabel;
seddays: TSpinEdit;
procedure btncalcClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
// sedHours and sedDays are SpinEdits
// Rand (R) is South African currency …Run Code Online (Sandbox Code Playgroud) 是否{}和//两者都根据大小添加注释?
抱歉这个愚蠢的问题,但是当我尝试google"{} // Delphi"时,我会获得Delphi.com和Wikipidia的链接以获取随机信息.
我前几天买了一台新笔记本电脑(用于游戏,学校).我安装了Delphi-7,只是遇到错误和无意义.
当我从Windows打开.dpr文件时,我收到错误消息There was a problem sending the command to the program.
我正在运行Windows 8SL,我还设置了与Windows XP Service Pack 2的兼容性,并以管理员身份运行.
我在谷歌搜索了这些错误,我一直在寻找微软Word,Excel等的东西.
除了回到Win7之外还有其他选择吗?
我没有生活线索如何在c#中写这个.我知道如何在Delphi中做到这一点.
这就是我在Delphi中的表现:
Case Total of
80..100 : ShowMessage ('You got an A!');
60..79 : ShowMessage ('You got a B!');
50..59 : ShowMessage ('You got a C!');
40..49 : ShowMessage ('You got a D!');
0..39 : ShowMessage ('You got an E...');
end;
Run Code Online (Sandbox Code Playgroud)
我已经阅读了这方面的教程,但我不知道如何以我需要的方式使用/编写它.
这是我在c#中的版本:
switch (Total) //'Total' is a bunch of Integers divided together to get a Percentage
{
case 80..100: //Where 80% to 100% would achieve an A
{
MessageBox.Show("You got an A!");
}
case 60..79: //Where 60% to 79% …Run Code Online (Sandbox Code Playgroud) 我读到使用该Goto命令是非常糟糕的,可能会搞砸你的代码.我还读到有一项民意调查显示,如果他们看到goto命令和delphi在一起而且其他40%的人甚至不知道goto命令,那么40%的Delphi开发人员会非常交叉,为什么呢?
但无论如何,我正在制作一个程序,通过获得两个分数并获得这两个分数的平均值来检查你是否有资格获得助学金.为了获得助学金,您需要达到90%或更高的平均值,它将在标签中显示您的平均值,如果您符合其他标签的资格.我最近也了解了这个If命令,现在我正忙着玩它.
这是我的代码:
procedure TForm1.btnCalcClick(Sender: TObject);
var
iMaths, iScience, iAvarage : integer;
begin
iScience := sedScience.value;
iMaths := sedMath.value;
iAvarage := round((iMaths+iScience)/2);
if iMaths = 0
then
begin
showmessage ('Sorry, please put a propper value in the Maths and Science box!');
end;
if iAvarage >= 90
then
begin
lblAvarage.caption := 'Your avarage is: ' + IntToStr (iAvarage);
lblOutput.caption := 'You qualify for an Einstein Bursary!';
end
else
begin
lblAvarage.Caption := 'Your avarage …Run Code Online (Sandbox Code Playgroud) 我在创建动态按钮的新过程时遇到问题.单击该按钮时,它应该将项目发送到RichEdit.
我已经宣布了我的所有对象和程序.
这是我的代码:
type
TfrmSale = class(TForm)
redOutput: TRichEdit;
btnBuy: TButton;
procedure btnBuyClick(Sender: TObject);
private
pnlSale : TPanel;
edtQuantity : TEdit;
rgpOptions : TRadioGroup;
btnSelect : TButton;
procedure btnSelectCick(Sender: TObject);
public
{ Public declarations }
end;
var
frmSale: TfrmSale;
implementation
{$R *.dfm}
procedure TfrmSale.btnBuyClick(Sender: TObject);
begin
pnlSale := TPanel.Create(frmSale);
pnlSale.Parent := frmSale;
pnlSale.Left := 10;
pnlSale.Top := 10;
pnlSale.Width := 350;
pnlSale.Height := 250;
pnlSale.Visible := True;
edtQuantity := TEdit.Create(pnlSale);
edtQuantity.Parent := pnlSale;
edtQuantity.Left := 50;
edtQuantity.Top := 60;
edtQuantity.Width …Run Code Online (Sandbox Code Playgroud) 我得到一个错误,给变量一个计数值(不知道这是否有意义).
iCount := inc(iCount,1);
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
var
iCount : Integer;
procedure TForm1.FormActivate(Sender: TObject);
begin
edtOutput.SelAttributes.size := 10;
edtOutput.SelAttributes.name := 'Courier';
edtOutput.Lines.Add(('Name') + #9 + #9 + ('Age') + #9 + #9 + ('Child or adult'));
end;
procedure TForm1.btnOKClick(Sender: TObject);
var
sName :String;
iAge :Integer;
begin
iCount := inc(iCount,1); // <--- HERES THE ERROR
sName := edtName.text;
iAge := edtAge.value;
Run Code Online (Sandbox Code Playgroud)
当我给出iCount它的值时,我得到这个错误:
Incompatible types: 'Integer' and 'procedure, untyped pointer or untyped parameter'
哦,edtOutput是一个RichEdit.我已经完全复制了我的课本说我必须的(不是整个程序,只是那个iCount东西)
任何关于如何解决这个问题的建议将不胜感激!
我今天第一次开始使用c#.我最近一直在使用Delphi很多.
无论如何,我试图制作一个程序,检查你的商标是否等于或大于75%,如果是,标签将标题You shall receive a bursary!,等等.有三个文本框用于三组不同的商标,即IT,数学与科学.他们都是150.
这是算术:
Average = (((Maths/150)*100)+((IT/150)*100)+((Science/150)*100))/3;
Run Code Online (Sandbox Code Playgroud)
问题是,如果所有给定标记140/150= 93%,标签根本不显示任何内容,如果标记低于75%则不显示任何内容.
我剩下的代码:
private void button1_Click(object sender, EventArgs e)
{
string Name;
string Surname;
int Maths;
int Science;
int IT;
float Average;
Name = edtName.Text;
Surname = edtSurname.Text;
Maths = int.Parse(edtMaths.Text);
Science = int.Parse(edtScience.Text);
IT = int.Parse(edtIT.Text);
Average = (((Maths/150)*100)+((IT/150)*100)+((Science/150)*100))/3;
if (Average >= 75)
{
lblOutput.Text += "You shall recieve a bursary!";
}
Run Code Online (Sandbox Code Playgroud)
请帮我纠正我做错了什么,
谢谢 :)
delphi ×6
c# ×4
delphi-7 ×4
asp.net-mvc ×2
razor ×2
asp.net ×1
case ×1
html ×1
if-statement ×1