Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while doing pagination and sorting web grid become empty ,i tyrid to use ajaxcall back function but here while doing pagination its returning to the main page not to next page

What I have tried:

while doing pagination and sorting web grid become empty ,i tyrid to use ajaxcall back function but here while doing pagination its returning to the main page not to next page
i am getting the web grid value from a parameter passing to the controler
Posted
Updated 28-Apr-16 20:23pm
Comments
Patrice T 28-Apr-16 2:44am    
Too bad for you.
If you want help, you will need to give more details.
Member 12300401 28-Apr-16 3:05am    
yeah tell me what information you want i will give
bjay tiamsic 28-Apr-16 21:15pm    
Your codes
Member 12300401 29-Apr-16 2:25am    
<script type="text/javascript">
$(document).ready(
function () {
$(window).load(function () {

$.ajax({

url: '@Url.Action("ShowAppraisalPeriod", "Administration")',
cache: false,
type: "Get",
datatype: "JSON",
error: function (error) {
alert(JSON.stringify(error));
},
success: function (objt) {
for (var i = 0; i < objt.length; i++) {
var opt = new Option(objt[i].appraisalidDescription, objt[i].appraisalid)
$('#appraisalid').append(opt);
}

GetstatusbyAppraisalid();
}
});

});
});
</script>
Member 12300401 29-Apr-16 2:25am    
<script>
function GetstatusbyAppraisalid() {
var ddlperiodId = $("#appraisalid option:selected").val();
var perfAppraisalId = "";
debugger;
var employeeId="";
var employeeName ="" ;
$.ajax({
// url: '/ManageKRAs/InsertData/', // HomeController and InsertData method
url: '@Url.Action("ShowStatusDetailsbyPeriod", "Administration")',
data: JSON.stringify({ AppraisalPeriod: ddlperiodId, PerfAppraisalId: perfAppraisalId, EmployeeId: employeeId, EmployeeName: employeeName }),
type: 'POST',
datatype: "html",
contentType: 'application/json; charset=utf-8',
cache: false,
success: function (result) {

if (result != null) {

$("#divappraisalperioddetails").html(result);

}

},
error: function (result) {


}
});
}

</script>

1 solution



Razor
  @{
        var grid = new WebGrid(Model, ajaxUpdateContainerId: "ajaxgrid", rowsPerPage: 20, canPage: true, canSort: true, ajaxUpdateCallback: "GetstatusbyAppraisalid");

        IEnumerable<webgridcolumn> cols =
            new List<webgridcolumn> {

                    new WebGridColumn{
                        ColumnName="empid",
                        Header="emp ID",

                        CanSort = true,Style= "colour:black !important",
                        Format = @<text>
        <span class="display"><label id="lblKraId">@item.empid</label></span>

                        </text>
                    },
                    new WebGridColumn{
                         ColumnName="emp",
                        Header="EmployeeID",
                        Format = @<text>

        <span class="display"><label id="lblName">@item.EmployeeId</label></span>


                        </text>
                    },
                    new WebGridColumn{
                        ColumnName="",
                        Header="Empname",
                        Format = @<text>
        <span class="display"><label id="lblWeightage">@item.EmployeeName</label></span>

                        </text>
                    },
                    new WebGridColumn{
                        ColumnName="Grade",
                        Header="Grade",

                        Format = @<text>
        <span class="display"><label id="lblEmail">@item.Grade</label></span>



                        </text>
                    },
                    new WebGridColumn{
                        ColumnName="Position",
                        Header="Position",
                            CanSort = true,Style= "colour:black !important",
                        Format = @<text>
        <span class="display"><label id="lblpos">@item.Position</label></span>


                        </text>
                    },
                    new WebGridColumn{
                        ColumnName="status",
                        Header="Status",
                        Format = @<text>

        <span class="display"><label id="lblStatus">@item.AppraisalStatus</label></span>

                        </text>
                    },
                    new WebGridColumn{
                        Header="Action",
                        Format = @<text>
        <input type="radio" />
                        </text>
                    },
                };
    }
</webgridcolumn></webgridcolumn></div>

@grid.GetHtml(columns: cols, rowStyle: "oddRowStyle", alternatingRowStyle: "evenRowStyle"
    , tableStyle: "gridTable", selectedRowStyle: "gridAltRow", htmlAttributes: new { id = "ajaxgrid" }) 
 
Share this answer
 
v2

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