Dear all,
Compliment of the season, I am prety new to ASP.NET MVC but when through some tutorials and i am able to get my fingers on it step by step.
I have some issue with the displaying my records in rows below is my code from the Index.cshtml
- @model System.Data.DataTable
- @{
- ViewBag.Title = "Index";
- }
-
- <table class="table table-bordered table-striped table-responsive">
- <tr>
- <th>First Name</th>
- <th>Last Name</th>
- <th>Other Name</th>
- <th>Email</th>
- <th>Address</th>
- <th>B Month</th>
- <th>Martal Status</th>
- <th>Member Status</th>
- <th>
- Edit
- </th>
- <th>
- Delete
- </th>
-
-
- </tr>
- <tr>
-
- @for (int i = 0; i < Model.Rows.Count; i++)
- {
- <td>@Model.Rows[i][1]</td>
- <td>@Model.Rows[i][2]</td>
- <td>@Model.Rows[i][3]</td>
- <td>@Model.Rows[i][4]</td>
- <td>@Model.Rows[i][5]</td>
- <td>@Model.Rows[i][6]</td>
- <td>@Model.Rows[i][7]</td>
- <td>@Model.Rows[i][8]</td>
- <td><a class="btn btn-primary" href="@Url.Action("Edit", "Member", new {@[email protected][i][0] })" >Edit</a></td>
- <td><a class="btn btn-danger" href="@Url.Action("Delete", "Member", new {@[email protected][i][0] })">Delete</a></td>
- }
- </tr>
-
- </table>
-
- <a href="@Url.Action("Create","Member")" class="btn btn-sm btn-primary">Add Member</a>
-
- @*<button id="my-button" onclick="location.href='@Url.Action("YourActionName", "YourControllerName")'">Submit</button>*@
my Model code is as follows (I am not using Entity Frame work)
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace HIGHGROUNDMCV.Models
- {
- public class MembersModel
- {
- public int ID { get; set; }
- [DisplayName("First Name")]
- public string FName { get; set; }
- [DisplayName("Last Name")]
- public string LName { get; set; }
- [DisplayName("Other Name")]
- public string OName { get; set; }
- public string Email { get; set; }
- public string Address { get; set; }
- [DisplayName("Month of Birth")]
- public int MOB { get; set; }
- [DisplayName("Marital Status")]
- public string MStatus { get; set; }
- [DisplayName("Member Status")]
- public string MembStatus { get; set; }
- }
- }
then the result i am getting is as follows
I want the records to show in rows all show in a single row, please what am i doing wrong.
thank you for your help