Solved

MVC 5 VB.Net Application Trouble

Posted on 2014-02-18
3
353 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
Comment Utility
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
Comment Utility
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
Comment Utility
Found my own solution!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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