Solved

MVC 5 VB.Net Application Trouble

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do see the validation errors on ASP.NET MVC 4 37
Calling stored proc in EDMX 11 24
Json and asp.net mvc 2 45
Interview questions for support of a legacy ASP.NET site 4 39
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

867 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now