c# - if statement to only show data that has ID -


i have simple view returns results database, id there data , there not.

i need way, maybe if statement show results have id.

any ideas how view this:

    <table id="listgrid" 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 (m1dal.test.stion intem in model.allslised)     {         <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> 

you can add filter

@foreach (var item in model.where(m => m.id != null)) 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -