views:

20

answers:

1

I have an MVC application with a link to print the information. the print link is inside a javascript. code as follows:

<td>
<%= Html.TextBox("Name", Model.ApplicantStatus.Name) %>
<%= Html.ValidationMessage("Name", "*") %>
</td>

<script type="text/javascript">
var myEmail = "[email protected]";
var mySubject = "Sample";
var myBody = "My name is ";
var myName = Model.TableName.Name;
document.write('<a href="mailto:' + myEmail + '?subject=' + mySubject + '&body=' + myBody + myname + '">email me</a>');
</script>


basically var myName = Model.TableName.Name; is not working. any workarounds?

+1  A: 

Change the line to

 var myName = <%=Model.TableName.Name%>;
John Sheehan
+1 Too fast! :)
Andrew Hare
I even got an edit in on the post before answering :P
John Sheehan
LOL - You are a steely-eyed missle man. :)
Andrew Hare