tutorials in 37065

Topics: blog
Mar 2, 2010 at 11:52 PM

Hi,

I'm trying to use your NHaml sample from the source code of revision 37065.

I see that in UserController you have:

       public IViewData Index()

        {

            ViewData["whom"] = "World";

            return Render();

        }

which leads me to believe that you are replacing the variable whom in the haml with "World". However, when I look at Views/User/index.html, there is no variable "whom":

#main

  %p

    = "Hello World"

I rewrote Views/User/index.html to include whom:

#main

  %p

    = "Hello"

    =whom

 

and I got the following complaint:

An error occurred when compiling the file: /user/index.haml

c:\Documents and Settings\<username>\Local Settings\Temp\urr8e_yk.0.cs(54,43) : error CS0103: The name 'whom' does not exist in the current context

0052:         textWriter.Write("      ");

0052:         textWriter.Write(Convert.ToString(whom));

0054:         textWriter.WriteLine();

 

Would you mind explaining where I am going wrong?

Thank you for your time,

LDY

 

Coordinator
Mar 10, 2010 at 9:22 AM

Fixed.

 

You need to write:

 

= ViewData["whom"]

Don't know how to fix typed views yet.