4

I am having the following piece of code that is not working:

<a href="#" onclick="Edit(@Interest);">edit</a>

where I have

@{string Interest=""}

learning
  • 11,415
  • 35
  • 87
  • 154

2 Answers2

6

You need to quote the string like this:

<a href="#" onclick="Edit('@Interest');">edit</a>
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93
1

If you want to call a method e.g. @Url.Action("test") for an action link, then you have to use it like:

<a href='@(Url.Action("test"))'>test</a>

Otherwise korchev's solution is right.

kapsiR
  • 2,720
  • 28
  • 36