Click here to Skip to main content
15,902,299 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
@foreach (DataRow row  in Model.Tables["tbInsertMobile"].Rows)
   {
        <tr>
           @* <td>@(row["MobileID"])
             <input type="text" id="Txtmid" style="display:none"/>
            </td>*@
              <td>@(row["MobileName"])
             <input type="text" id="Txtmob" style="display:none"/>
            </td>
            <td>@(row["MobileIMEno"])
                <input type="text" id="TxtMEno" style="display:none;"  />
            </td>
            <td>@(row["mobileprice"])
                 <input type="text" id="Txtprice" style="display:none" />
            </td>

            <td>@(row["mobileManufacured"])
                  <input type="text" id="TxtManufacured" style="display:none" />

            </td>
            <td><input type="button" value="Edit" id="btnedit" class="adt" /></td>
            <td>
                <input type="button" value="update" id="btnupdate" />
            </td>
            <td>
                <input type="button" value="Delete" id="btndelete" />
            </td>


        </tr>
   }


What I have tried:

How to select data from  multiple table in mvc. 
Posted
Updated 28-Mar-17 1:06am
Comments
Karthik_Mahalingam 28-Mar-17 8:52am    
what is the issue?

1 solution

Crate a view model which contains properties as per the data you fetch from the table.

Create one view model to bind the data in view.

Public Class YourViewModel
{
Public string Prop1 {get;set;}
Public string Prop2 {get;set;}
Public string Prop3 {get;set;}
Public string Prop4 {get;set;}
}

Controller
---------------

Public ActionResult()
{
YourViewModel modl= new YourViewModel();

''' Yoor logic to bind the data into this model form DB.

return view ("YourViewName", Model);

}

View
---------
@model List<yourviewmodel>







@foreach(var item in Model)
{






}
Prop1Prop2Prop3Prop4
@item.Prop1@item.Prop2@item.Prop3@item.Prop4
 
Share this answer
 

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