0

How can I use c# code in a Javascript statement?

This is my code:

document.getElementById('part1').innerHTML = '' +
'@Html.Partial("SelectCustomer.Views")'
' Views';

@Html.Partial("SelectCustomer.Views") and <%= and %> do not work

0

1 Answer 1

1
 @Html.Raw("document.getElementById('part1').innerHTML = '' +
 @Html.Partial("SelectCustomer.Views")
 ' Views';");

Don't have razor project on hand to test it. Might need to remove the @ from the second Html.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.