Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I cannot access to dynamic object properties in Razor Template

I created a dynamic object like below:

dynamic myObject = new
{
    DisplayName = "Mahesh"
}; 



Content = Parse("Main", myObject);

debug section

Then I parsed it for Razor template. But it doesnt work because of the object cannot access to its properties. What is the problem here ?

Thanks in advance,

like image 688
Barış Velioğlu Avatar asked Sep 06 '11 08:09

Barış Velioğlu


1 Answers

I did it by this way and it works. But I want to know why the way I did first is not working

dynamic FooterModel = new ExpandoObject();
FooterModel.DisplayName= "Kaplan";
like image 86
Barış Velioğlu Avatar answered Nov 03 '22 10:11

Barış Velioğlu