Note that there are some explanatory texts on larger screens.

plurals
  1. POHow in asp.net mvc create link that refer to some model.property?
    primarykey
    data
    text
    <p>I have strong-type view, I want to create link that refers to Model, which is strong-typed with that view, some property (e.g Model.property). How can I do that? I use net4.0. when I write "> it do nothing. Even visual studio don't recognize it when I write &lt; a href="&lt;%: and click ctrl+space it doesn't bring anything. This is my view </p> <pre><code>&lt;%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage&lt;UrlParser.Models.Parse&gt;" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;Show&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt; Title: &lt;/h1&gt; &lt;%: Model.title %&gt; &lt;br /&gt; &lt;h1&gt; Description: &lt;/h1&gt; &lt;%: Model.description %&gt; &lt;% if(!Model.video.Equals("")) { %&gt; &lt;h2&gt; Video:&lt;/h2&gt; &lt;%: Model.video %&gt; &lt;a href="&lt;%: Model.video %&gt;"&gt; &lt;/a&gt; &lt;% } %&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I want my link refer to Model.video.</p> <p>These is my controler:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using UrlParser.Models; namespace UrlParser.Controllers { public class HomeController : Controller { // // GET: /Home/ [HttpGet] public ActionResult Index() { return View(); } [HttpPost] public ActionResult Index(GetUrl getUrl) { // int i = 0; Parse prs = new Parse(getUrl.url); return View("Show", prs); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload