Solved

MVC 5 VB.Net Application Trouble

Posted on 2014-02-18
3
361 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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