Asp.net show data in controller's view -
i have type of data output of mvc controller , view...
please see image links
i have different subcategory values 1 , 2 product,, here output now:
here output shows values products
what output expecting here:
values each product vertically.. can explain more via chat , can send code check ,, provide code here ....
here table showing values ...
my code of mvc controller...
using system.data.entity; using system.linq; using system.net; using system.web; using system.web.mvc; using productcomparer.dal; namespace productcomparer.controllers { public class productcomparecontroller : controller { private productcompareentities1 db = new productcompareentities1(); // get: /productcompare/ public actionresult index() { return view(db.tblproductsbcategoryvals.tolist()); }
myviewmodel
@model ienumerable<productcomparer.dal.tblproductsbcategoryval> @{ viewbag.title = "index"; } <h2>index</h2> <p> @html.actionlink("create new", "create") </p> <table class="table"> <tr> <th> @html.displaynamefor(model => model.prodid) </th> <th> @html.displaynamefor(model => model.subcatid) </th> <th> @html.displaynamefor(model => model.subcatvalue) </th> <th></th> </tr> @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.prodid) </td> <td> @html.displayfor(modelitem => item.subcatid) </td> <td> @html.displayfor(modelitem => item.subcatvalue) </td> @* <td> @html.actionlink("edit", "edit", new { id=item.pk_id }) | @html.actionlink("details", "details", new { id=item.pk_id }) | @html.actionlink("delete", "delete", new { id=item.pk_id }) </td>*@ </tr> } </table>
my model
namespace productcomparer.models { public class productsmodel { public list<product> products { get; set; } public list<subcategory> subcategories { get; set; } } public class productsubcategories { public int productid { get; set; } public int subcategoryid { get; set; } public string subcategoryname { get; set; } }
Comments
Post a Comment