Question

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 = "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?

Was it helpful?

Solution

Change the line to

 var myName = <%=Model.TableName.Name%>;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top