Solved

MVC 5 VB.Net Application Trouble

Posted on 2014-02-18
3
358 Views
Last Modified: 2014-04-13
Hi,

I'm editing the vbhtml file to loop through records to match in a small demo app I'm making,

Here's how it seems to work in C#:
 @foreach (var item in Model.Enrollments)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Course.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Grade)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Course.Credits)
            </td>
        </tr>
    }

Open in new window


I attempted to convert it to vb, but I'm getting errors... I'm sure it's simple but I'm completely new to mvc...

        @For Each item In Model.Times
             
        <tr>
            <th>
                @item.Activity.ToString 
            </th>

            <th>
                @item.StartTime.ToString  
            </th>

            <th>
                @item.EndTime.ToString 
            </th>
        </tr>
        
        Next
                
    </table>

Open in new window


It gives errors on the HTML tags "<th>" and "<th/>" :

"Attribute specifier is not a complete statement.  Use a line continuation to apply the attribute to the following statement."

Any help greatly appreciated.

Thanks
~j
0
Comment
Question by:prosit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 7

Expert Comment

by:Kishan Zunjare
ID: 39869482
Your possible solution can be;

@For Each item In Model.Times             
     <tr>
	@<td>@item.Activity.ToString</td>
 	@<td>@item.StartTime.ToString</td>
	@<td>@item.EndTime.ToString </td>
     </tr>        
Next

Open in new window

0
 
LVL 2

Accepted Solution

by:
prosit earned 0 total points
ID: 39876880
Yeah that didn't work either, basically I had to encapsulate the TR in a text tag:

@For Each item In Model.Times            
  @<text>
     <tr>
      @<td>@item.Activity.ToString</td>
       @<td>@item.StartTime.ToString</td>
      @<td>@item.EndTime.ToString </td>
     </tr>  
  @</text>    
Next
0
 
LVL 2

Author Closing Comment

by:prosit
ID: 39997100
Found my own solution!
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question