asp.net mvc - Can't get to property in razor foreach -


i'm still new mvc , razor , i'm hoping can me out something. able use following code print line (using @reply.getproperty("propertyname") when try assign variable (test) code fails. why , how can around it? need able assign , use further in other code.

    @foreach (var reply in currentpage.children)     {         @reply.getproperty("propertyname")         @{             string test = reply.getproperty("propertyname");         }     } 

in view

@{    string test = string.empty;  }  @foreach (var reply in currentpage.children)     {         @reply.getproperty("propertyname")         test = reply.getproperty("propertyname");      } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -