For one line statements you should use the @ sign instead of putting it in a code block.
If you still put it in a code block (there are some cases you need to) it won't display your grid by just calling grid.GetHtml();
This is why the @ sign is used, it means that you want to write out some value, but you should only use this if you are writing in HTML code. When using a code block, you have to tell the server that this value should be written out, like this:
@{
this.Write(grid.GetHtml());
}