Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an MVC application and I have it successfully displaying information from two different tables in one view page in VB.NET. But I am having trouble trying to display information in a details view page with two tables in the application. I think the trouble I am having is with the ID's.

All the information I will be displaying will be about one specific ID, therefore in the view page the modelType will be like this:
VB
@ModelType clientApp.iTracker.ICClass


instead of:
VB
@ModelType IEnumerable(Of clientApp.iTracker.ICClass)


This is because I do not need a foreach to display the information as it should be specific to the ID of the issue.

Currently what I am trying to do is in the controller to get the specific ID selected:

VB
Dim IssTable As IssueTable = dbS.IssueTables.Find(id)


In the previous page I will select the issue in the view like this:

VB
@Html.ActionLink(item.iTable.ProjectTypeID.ToString(), "DetailsIssue", New With {.id = item.iTable.IssueID})


Then in the detailed view I am trying to display the information like this:

VB
@Html.DisplayFor(Function(model) model.iTable.Created)


My class looks like this;

VB
Namespace IssueTracker
    Public Class IssueComments
        Public cTable As CommentTable
        Public iTable As IssTable
    End Class
End Namespace


But this is not working. What is the correct way to display information from two tables in a detailed view page in MVC VB.NET?
Posted

1 solution

You can use ViewModel approach for the given problem.
You can know more about problem here (C# Code)
http://rahulrajatsingh.com/2014/06/a-beginners-tutorial-on-various-ways-of-passing-data-in-asp-net-mvc-application/
 
Share this answer
 
Comments
Ciaran82 23-Jul-15 9:47am    
How would I change:
Book book = new Book
{
ID = 1,
BookName = "Sample Book",
Author = "Sample Author",
ISBN = "Not available"
};

Into an id that was selected by the user so it is not hard coded?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900