this is my code
ProductController.cs
public ActionResult Details(string id)
{
product productx = productDB.products.Single(pr => pr.Product1 == id);
return View(productx);
}
Details.aspx
<td>
<%-- : Html.ActionLink("Edit", "Edit", new { id=item.Id }) % -->
<%: Html.ActionLink("Details", "Details", new { id = item.Product1 })%>
</td>
this is what im using to list some products from a sql database, each product have a link to a Details page to show more informations about it
what Im trying is to only put the product label in that link to let it show something like www.mysite.comproductsattery (not the id)
I've imagined this should work, but it throw an The data types text and nvarchar are incompatible in the equal to operator. error and
neither (pr => pr.Product1.Equals(id));
works
the error is clear and Im asking how should I do to make it work this way ?
thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…