I have data in a page comming from database.
however i want some validations,
-show only value that has id
-show which has the word "test" in
at the moment my database is like:
| id | name | Number |
|:-----------|------------:|:------------:|
| 1 | Test | 23223
| 2 | column | 23232
| | will | 34
| 5 | be | 343
| | test | 343
| | aligned | 2343
My html view:
<table id="PartsResultListGrid" class="table table-striped table-bordered">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.id)
</th>
<th>
@Html.DisplayNameFor(model => model.name)
</th>
<th>
@Html.DisplayNameFor(model => model.number)
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.id)
</td>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
<td>
@Html.DisplayFor(modelItem => item.number)
</td>
<div class="clear"></div>
</div>
</td>
</tr>
}
</tbody>
</table>
Back end:
public List<M1DAL.SC42Prod.SCOption> Allinfo { get; set; }
public Serialised(string id)
public string mainId { get; set; }
{
mainId = id);
Allinfo = _sc42Prod.SCOptions.Where(s => s.mainId == mainId ).ToList();
}
so as it stands in my web page it lists all data from the database.
however i want to add some statements
-show only that has id
-show which has the word "test" in
so for this will i need if statement in the view or do i do this back end, and how.
Any help will be Great
Aucun commentaire:
Enregistrer un commentaire