This is a migrated thread and some comments may be shown as answers.

Issues with column templates in Razor

3 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nathanael
Top achievements
Rank 1
Nathanael asked on 09 Jul 2011, 12:18 AM
I keep having issues setting up column templates in the Razor view engine. I keep getting this error message:

Compiler Error Message: CS1002: ; expected

And here's my code sample. Any ideas?


if (!string.IsNullOrWhiteSpace(clpo.PrintOption.PrintOptionThumbnailUrl))
 {
      @<text><img src="@(clpo.PrintOption.PrintOptionThumbnailUrl)" style="height:150px;width:150px;" alt="@(clpo.PrintOption.PrintOptionName)" /></text>
}

3 Answers, 1 is accepted

Sort by
0
Accepted
John DeVight
Top achievements
Rank 1
answered on 09 Jul 2011, 02:53 PM
Hi Nathanael,

Give this a try:

@<text>
@if (!string.IsNullOrWhiteSpace(clpo.PrintOption.PrintOptionThumbnailUrl))
{
      <img src="@clpo.PrintOption.PrintOptionThumbnailUrl" style="height:150px;width:150px;" alt="@clpo.PrintOption.PrintOptionName" />
}
</text>

If it doesn't work, could you post the code for the entire grid and I'll see what I can do...

Regards,

John DeVight
0
Nathanael
Top achievements
Rank 1
answered on 09 Jul 2011, 08:24 PM
That worked.
Actually I kind of figured it out myself yesterday, but at least everyone gets to see a solution now.
Counterintuitive, to be sure but my only complaint with Razor so far :)

Thanks!
0
John DeVight
Top achievements
Rank 1
answered on 10 Jul 2011, 07:45 PM
Glad to hear you got it working =)
Tags
Grid
Asked by
Nathanael
Top achievements
Rank 1
Answers by
John DeVight
Top achievements
Rank 1
Nathanael
Top achievements
Rank 1
Share this question
or