Hi @lm1212 ,
Asp.net core Razor supports C# and HTML comments:
@{
/* C# comment */
// Another C# comment
}
<!-- HTML comment -->
The code renders the following HTML:
<!-- HTML comment -->
Razor comments are removed by the server before the webpage is rendered. Razor uses @* *@
to delimit comments.
@*
@{
/* C# comment */
// Another C# comment
}
<!-- HTML comment -->
*@
More detail information about the Razor syntax, see Razor Comments.
In your code, since you are using TableTemplate, I assume it is a Blazor component, right? The Blazor components also use Razor syntax.
So, to comment the @code { }
, we can use @* *@
.
For example trying to comment out line 72 here ( @Aidan Wick { ) just does not seem to be possible.
For your example page, you can remove the //
and use @* *@
. After that clean and rebuild the project. Check the following screenshot:
You can view the source code from here: 243218-sourcecode.txt
Besides, the Blazor component support Partial class, for the code in the @code
blocks, we can create a partial class and place the code in the partial class (.cs) file. Then, in the partial class file, we can use //
to add comments, and in the .Razor file, we can add comments use @* *@
.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion