这是我的代码。这只是我在文本编辑器中编辑的基本cshtml页面(不是MVC)。 Visual Studio并没有太大帮助,它似乎遇到了与编译器相同的问题。
该代码将“计划”中的步骤列表打印到从db查询中检索的表中。可能有多个计划,每有一个新计划,我都希望在面板中显示其名称,然后在表格中显示其步骤。这意味着关闭当前表并开始一个新表。
当结束标记“不合适”时,编译器似乎无法处理它们。我尝试了使用Html.Raw()
和不使用@{
var db = Database.Open("CADDatabase");
var count=0;
var num="0";
var image="blank";
var APName="blank";
// Attached action plan for incident
var APIncidentQuery=@"select action_plan_name, action_plan_item_types.item_type_eng, pre_mobilisation_flag, instruction_text, isnull(action_plan_active.instruction_information,' ') as instruction_information, item_status_eng
from action_plan, action_plan_active, action_plan_item_types, action_plan_status
where action_plan_item_types.item_type=action_plan_active.item_type
and action_plan_active.item_status=action_plan_status.item_status
and action_plan.action_plan_id=action_plan_active.action_plan_id
and action_plan_active.eid=(select min(eid) from agency_event where num_1=@0) order by action_plan_active.action_plan_id, active_item_id";
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="theme.css">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Process Action Plan</title>
</head>
<body>
<!-- Panel header with search box -->
<div class="container-fluid ">
<div class="row no-gutters">
<div class="col-xs-12">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<form method="get" class="col-xs-3">
<div class="input-group">
<input class="form-control" type="text" placeholder="Event id" name="EventId" size="12">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Search</button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Header row -->
<div class="row no-gutters">
@foreach(var row in db.Query(APIncidentQuery,Request.QueryString["EventId"])){
image="Images/ActionPlans/" + @row.item_type_eng + ".png";
// New plan
if (row.action_plan_name != APName) {
// Close off previous table if there is one
if (APName != "blank") {
Html.Raw("</tbody></table></div></div>");
}
<!-- Start new table -->
<div class="col-xs-12">
<div class="panel panel-warning">
<div class="panel-heading">
<div class="plan-header">
<img src="http://swi-hsiv-ps03/UKApps/Images/checklist-warning.png" height="32">
<h3 class="panel-title">Action plan items (@row.action_plan_name)</h3>
</div>
</div>
<!-- Table of results -->
<table class="table table-condensed table-striped">
<thead>
<tr>
<th>#</th>
<th>Type</th>
<th>Pre-dispatch</th>
<th>Instruction</th>
<th>Additional Info</th>
</tr>
</thead>
<tbody>
<!-- store plan name for next iteration -->
@{
APName=row.action_plan_name;
}
<!-- Populate new table -->
}
<!-- List Action Plan items -->
<tr>
<td>@row.item_number</td>
<td><img src="@image" height="30" title="@row.item_type_eng"></td>
@if (row.pre_mobilisation_flag == "Y") {
<td><img src="images/ActionPlans/done-red.png" title="Y" height="30"></td>
} else {
<td><img src="images/ActionPlans/delete-grey.png" title="N" height="30"></td>
}
<td>@row.instruction_text</td>
@if (row.instruction_information.Length > 4 && row.instruction_information.Substring(0,5) == "http:") {
<td><a href=@row.instruction_information>Additional information</a></td>
} else {
<td>@row.instruction_information</td>
}
</tr>
}
@{
Html.Raw("</tbody></table></div></div>");
}
</div>
</div>
</body>
</html>
的情况,结果相似。有没有一种技术可以使之编译?
/**
* Key code of pressed modifier key.
*
* @param keyEvent the received key event
* @return the key code or 0 if no modifier key is pressed
*/
private static int getModifierKeyCode(KeyEvent keyEvent) {
return (keyEvent.stateMask & SWT.MODIFIER_MASK);
}
答案 0 :(得分:0)
通过将其重写为2个查询来解决,一个查询获得计划列表,另一个查询列出每个列表中的项目。然后,这些表完全包含在foreach循环中。