views:

49

answers:

2

I'm trying to build a link to an external website using some properties of my model class in my view page, e.g. I want it to render as something like -

< a href="http://twitter.com/home?status=Currently reading http://www.mywebsite.com/post-id">Twitter < /a>

where post-id would be pulled from the model (I'm using a strongly typed view model here - I can't use ViewData as there's a list of items being pulled back all of which need seperate links).

I tried doing < a href="<% model.PermaLink(); %>">, where PermaLink is just some string, however the value doesn't get picked up.

If I try < a href="<%= model.PermaLink %>">, I get an error - CS1502: The best overloaded method match for 'System.IO.TextWriter.Write(char)' has some invalid arguments

Is there any way to do this? I tried adding the runat="server" attribute, however this just linked to my local site and controller/model actions.

A: 

Is this within an MVC ViewPage, based on the ViewPage class, or is it a WebForms page?

the < a href="<%= model.PermaLink %>"> syntax is correct for an MVC Page

Clicktricity
Yeah, it's on a MVC ViewPage.
mcfroob
A: 

Whoops, hadn't setup my property properly, was just using a regular getter. Maybe I should go back to Java :)

mcfroob