Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

How could we fetch the data from Db and render in to the view using jquery ajax get method
we don't want to use any other gridview like (jqgrid,mvccontrib grid or any other third party tool)
Currently we are calling data directly from the model using below code
@model PagedList.IPagedList<..........>

XML
<table class="table table-striped table-bordered table-condensed mGrid">

<tr>
<th>System reference</th>
<th>Reference</th>
<th>Name</th>
<th>Surname</th>
<th>Client</th>
<th>Edit</th>
</tr>
@foreach (var m in Model)
{
    <tr id=tr-@m.ID>
        <td>
            <div id="divSystem_Reference-@m.ID.ToString()" class="control-group">
            @*<label id="lbl-@m.ID.ToString()">@m.System_Reference.ToString()</label>*@
            <input id="txt-@m.ID.ToString()" type="text"  class="input-small" value=@m.System_Reference.ToString() />
            </div>
        </td>
        <td>
            <div id="divReference-@m.ID.ToString()"  class="control-group">
            <div class="controls">
           @*  <label id="lblReference-@m.ID.ToString()">@m.Reference.ToString()</label>*@
            <input id="txtReference-@m.ID.ToString()" type="text"   class="input-small"  value=@m.Reference.ToString() />
            </div>
            </div>
        </td>
        <td>
            <div id="divName-@m.ID.ToString()"  class="control-group">
            @* <label id="lblName-@m.ID.ToString()">@m.Name.ToString()</label>*@
            <div class="controls">
            <input id="txtName-@m.ID.ToString()" type="text"   class="input-small"  value=@m.Name.ToString() />
            </div>
            </div>
        </td>
        <td>
            <div id="divSurname-@m.ID.ToString()"  class="control-group">
             @*<label id="lblSurname-@m.ID.ToString()">@m.Surname.ToString()</label>*@
             <div class="controls">
            <input id="txtSurname-@m.ID.ToString()" type="text"   class="input-small"  value=@m.Surname.ToString() />
            </div>
            </div>
        </td>
        <td>
            <div id="divClient-@m.ID.ToString()"  class="control-group">
             @*<label id="lblClient-@m.ID.ToString()">@m.Client.ToString()</label>*@
             <div class="controls">
            <input id="txtClient-@m.ID.ToString()" type="text"  class="input-small"   value=@m.Client.ToString() />
            </div>
            </div>
        </td>
        <td>
           
            <button id="btnEdit-@m.ID.ToString()"  class="btn btn-primary" >Edit</button>
            <button id="btnSave-@m.ID.ToString()"  class="btn btn-primary" >Save</button>
        </td>
    </tr>
}
</table>




Please help me my above issue
Thanks & Regards,
Soumya
Posted
Updated 25-Jun-13 3:13am
v3
Comments
Zoltán Zörgő 25-Jun-13 9:33am    
It is not that hard. What have you tried?
You need an action that return the data in json, and a javascript function that updates the table element.
Still, you should consider this one too: http://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP

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