How to strip html tags from string in listing page in c#
I have tried Regex.Replace(inputHTML, @"<[^>]+>| ", "").Trim(); but this is not working in html view page may be this only work in controller.
This is my action :
public ActionResult Index()
{
string AuthRole = "1,2,3";
ApplicationUser chkuser = common.CheckIsAuthorize(AuthRole);
if (chkuser != null)
{
var data = db.Page.ToList();
return View(data);
}
else
{
return RedirectToAction("Index", "Home");
}
}
This is my view :
foreach (var item in Model)
{
<tr>
<td>@i</td>
<td>@item.Title</td>
<td>@item.Message</td>
<td>
@Html.ActionLink("Edit", "Edit", new { id = item.Id })
</td>
</tr>
i++;
}
My listing look like below :
