Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I am following a tutorial in Razor with C# but I am using VB.Net and need help because my Code is not compiling.

HTML
var grid = new WebGrid(PostRepository.GetAll(orderBy: "DateCreated DESC"));

@grid.GetHtml(
columns: grid.Columns(
grid.Column(format: @<a href="~/admin/post/edit/@item.Slug">Edit</a>),
grid.Column("Published", format: @<span>@(item.DatePublished.HasValue ? item.DatePublished : "")</span>)
)



My VB.Net Code:

VB
@Dim grid = New WebGrid(PostRepository.GetAll(orderBy:="DateCreated DESC"))

    @grid.GetHtml(
    @columns:=grid.Columns(
    @grid.Column(format:=@<a href="~/Admin/post/edit/@item.Slug">Edit</a>),
    @grid.Column("Published", format:=<span>@If(@item.DatePublished.Hasvalue, 
    @item.DatePublished, "")</span>)
    )


What I have tried:

----------------------------------------------------------------
Posted
Updated 12-Dec-19 4:22am
v2
Comments
Richard MacCutchan 12-Dec-19 9:49am    
What is the question?
music0011 hop 12-Dec-19 9:57am    
Edited my question!
Richard MacCutchan 12-Dec-19 10:19am    
And again, what is the question?
music0011 hop 12-Dec-19 11:07am    
You don't have an idea of Razor, do you? Hahahaha
Richard MacCutchan 12-Dec-19 11:08am    
Well my Razor project compiles and runs fine, so yes I do.

1 solution

 
Share this answer
 
Comments
music0011 hop 12-Dec-19 11:28am    
According to your logic there is no need for CodeProject because one can find all answers by reading a short official Document on Microsoft Docs. This is not a wrong suggestion per se but mocking my question for not having the answer ready is against the logic of this forum.
Richard MacCutchan 12-Dec-19 11:50am    
I have not mocked your question, only your mocking comments. I asked you twice what your question was, and the only thing you posted was "my Code is not compiling.". So exactly how do you expect us to guess what error message the compiler may be producing, and what line it refers to?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900