我必须<a>在<label>标签内使用.因为有很多css样式只适用<a>于我们当前的系统.该<a>标签未链接到任何网页,但对于造型/徘徊.
见下面的代码:
<input type="checkbox" id="my-id">
<label for="my-id"><a href="javascript:void(0)">Some text</a></label>
Run Code Online (Sandbox Code Playgroud)
但是当点击"某些文字"时,它不会切换复选框状态.
我试过$.preventDefault()了<a>标签,但没有用.
我该怎么做才能使<a>表现像标签一样?
我正在尝试删除 C# 中的文件,但是我收到一条消息,指出该文件已从另一个进程使用。我想要做的是检查文件是否存在并关闭它。我正在使用以下函数来检查文件是否打开:
public static bool IsFileInUse(string path)
{
if (string.IsNullOrEmpty(path))
throw new ArgumentException("'path' cannot be null or empty.", "path");
try
{
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read)) { }
}
catch (IOException)
{
return true;
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试在使用文件时关闭它:
bool checking = IsFileInUse(file );
File.Create(file ).Close();
if (File.Exists(file))
{
File.Delete(file );
}
Run Code Online (Sandbox Code Playgroud)
我在 File.Create 行中遇到问题,我收到消息:
文件正被另一个进程使用。
编辑:我正在尝试使用锁定方法来删除文件。我应该删除锁定语句中的文件吗?如何正确使用lock语句?
我做了一个 DataBase Fisrt MVC 项目,但我遇到了一些问题。这是我的一个观点的索引:例如,我想要
@Html.DisplayNameFor(model => model.name)
显示为“用户”而不是“姓名”。
我怎样才能做到这一点?
提前致谢。
@model IEnumerable<dispensario.pacientes>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Create New", "Create")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.name)
</th>
<th>
@Html.DisplayNameFor(model => model.cedula)
</th>
<th>
@Html.DisplayNameFor(model => model.carnet)
</th>
<th>
@Html.DisplayNameFor(model => model.tipo_paciente)
</th>
<th>
@Html.DisplayNameFor(model => model.estado)
</th>
<th></th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.cedula)
</td>
<td>
@Html.DisplayFor(modelItem => item.carnet)
</td>
<td>
@Html.DisplayFor(modelItem => item.tipo_paciente) …Run Code Online (Sandbox Code Playgroud)