You seem to be mixing up client side and server side code. The variable "pippo" is getting defined as the literal string "{{status.utente}}" which isn't going to parse as an integer. Hard to help further without seeing what you are trying to do, but looks like you need to rethink things here.
Anything within @{ } in Razor is C# code, evaluated server side.
For client side code it should be within a <script></script> block.
angular var inside razor
Good morning, I have this problem, if I do:
@{ var pippo = "{{status.utente}}"; }
<p>utente: @pippo </p>
I retreve the utente number correctly but if I do:
@{
var pippo = "{{status.utente}}";
int gigi = int.Parse(pippo);
var nome = Umbraco.Member(gigi).Name;
}
<p>utente: @nome </p>
during parsing I retreve an error "Input string was not in a correct format."
May you help me?
Thanks in advance.
Lorenzo
You seem to be mixing up client side and server side code. The variable "pippo" is getting defined as the literal string "{{status.utente}}" which isn't going to parse as an integer. Hard to help further without seeing what you are trying to do, but looks like you need to rethink things here.
Anything within @{ } in Razor is C# code, evaluated server side.
For client side code it should be within a <script></script> block.
Andy
Ok sorry, I try to explain,
this code: @{ var user = "{{status.user}}"; }
<p>user: @user </p>
retrive the Id user (ex 1175), and it's ok I have user: 1175,
but I want after use 1175 to umbraco helper to get user property but I can't convert to int.
so when I do:
@{
var user = "{{status.user}}";
int gigi = int.Parse(user);
var name = Umbraco.Member(gigi).Name;
}
<p>utente: @name </p>
Any suggestion?
is working on a reply...