Hi Sivakumar,
Thanks for your update.
We suggest you to pass row index which you want to select from controller to view through response header and select row based on the row index in using _selectRow attribute. Please refer the below code snippets.
[Code snippet]
public ActionResult Index(PagingParams par)
{
if (par.GridID == "Grid1")
{
var data1 = Employee.GetList();
ViewData["GridData1"] = data1;
//Get the index of the record which you want to select
Response.AddHeader("RowIndex", data1.Select((obj, index) => new { obj.EmployeeID, Index = index }).SingleOrDefault(x => x.EmployeeID == 3).Index.ToString());
return data1.GridJSONActions<Employee>();
}
else if (par.GridID == "Grid2")
{
var data1 = Employee.GetList();
ViewData["GridData2"] = data1;
//Get the index of the record which you want to select
//Response.AddHeader("RowIndex", data1.Select((obj, index) => new { obj.EmployeeID, Index = index }).SingleOrDefault(x => x.EmployeeID == 3).Index.ToString());
return data1.GridJSONActions<Employee>();
}
return View();
}
[script]
<script type="text/javascript">
$('#Grid1').ajaxSuccess(function (evt, request, settings) {
var Index = request.getResponseHeader('RowIndex'); //get your data from response header
if (Index != null) {
var gridObj = $find('Grid1');
gridObj._selectRow=Index;
}
});
</script>
Please let us know if you have any concerns.
Regards,
Bala Murugan A.S