如何解决如何在行中查找点,然后在新行中添加内容后
现在我的内容是一行,但是我想新的内容是point(。)之后的新行
.cs
[HttpGet]
public async Task<ActionResult> Career()
{
HttpClient client = new HttpClient();
HttpResponseMessage responseMessage = client.GetAsync("https://localhost:0000/Home/displayVacancyData").Result;
if (responseMessage.IsSuccessstatusCode)
{
//data = await responseMessage.Content.ReadAsAsync();
//List<Vacancy> products = await responseMessage.Content.ReadAsAsync<List<Vacancy>>();
string result = await responseMessage.Content.ReadAsstringAsync();
List<Vacancy> vaca = JsonConvert.DeserializeObject<List<Vacancy>>(result);
ViewBag.message = vaca + "<br />";
return View("Career",vaca);
}
return View();
}
.cshtml
<table class="table table-striped border">
<thead>
<tr>
<th>Vacancy Title</th>
<th>Vacancy Position</th>
<th>Vacancy Experience</th>
<th>Vacancy Jobdescription</th>
<th>Vacancy requiredSkil</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach (var carr in Model)
{
//string newline = "\n";
<tr>
<td>@carr.vacancytitle</td>
<td>@carr.vacancyposition</td>
<td>@carr.vacancyexperience</td>
@*if()*@
<td>@carr.vacancyjobdescription@*<text> & nbsp;</ text >*@</td>
<td>@carr.vacancyrequiredskill</td>
<td>
@Html.ActionLink("Apply for Job","ApplyForJob")
</td>
</tr>
}
</tbody>
</table>
是指将新内容放在单独的行中
逻辑首先在行中找到point(。),然后在添加新行之后
string newline = "\n";
if(carr.vacancyjobdescription)
{
//issue is here how to find out point in line
and then add a <text>newline</text>
}
我正在尝试-主要问题是如何找到要点
<td>
@if (carr.vacancyjobdescription != null)
{
@carr.vacancyjobdescription
<text> </text>
}
</td>
解决方法
@{string data = "Hello. This is Test. Yo";
data= data.Replace(".","</br>");}
@*Then to display your value use...*@
@Html.Raw(data)
,
<td>
@{
string skillHtml = @carr.vacancyrequiredskill;
skillHtml = skillHtml.Replace(".","</br>");
}
@*Here we gonna display the html*@
@Html.Raw(skillHtml)
</td>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。