I need to pass a param to the image onclick event. I know how to do it using a script and the controller, but I would like to know if it can be done directly in the view ? I've searched the SO and tried some examples but nothing worked so far.
@{string test = "kkkk";}
<img onclick="alert('' + @test + '')" />
<img onclick="alert(@test)" />
@{string test = "alert('kkkk')";}
<img onclick="alert(@test)" />

'around your vars... for example<img onclick="alert('@test')" />, this treats it as a string, otherwise its looking for a javascript object with that name...