I am trying to create the name of a function dynamically:
I set the name in razor code:
@ { name="bob"; }
Then I try to create the javascript function, but the syntax is wrong.
function @name@:_onActivate() {
.....
}
How can I use @name in the name of the function?
I know im late to the party, but i had the same question and came up with this..
Use the @() Razor syntax:
function @(Model.Name)_Init() { .....some code... }
Works like a charm
(http://haacked.com/archive/2011/01/06/razor-syntax-quick-reference.aspx/)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With