I have an MVC application with a link to print the information. the print link is inside a javascript.
code as follows:
<%= Html.TextBox(“Name”, Model.ApplicantStatus.Name) %>
<%= Html.ValidationMessage(“Name”, “*”) %>
<script type="text/javascript">
var myEmail = "ChangeMe@abc.org";
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?
Wrap it in the string output tag and enclose it in quotes.
You need to use the string output tag to get the actual content from the variable. It needs to be in quotes to treat it as a string, otherwise it attempts to find a javascript object with that name.