Link to home
Start Free TrialLog in
Avatar of prosit
prositFlag for United States of America

asked on

MVC 5 VB.Net Application Trouble

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
Avatar of Kishan Zunjare
Kishan Zunjare
Flag of Australia image

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

ASKER CERTIFIED SOLUTION
Avatar of prosit
prosit
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prosit

ASKER

Found my own solution!