Hello Sam. Thank you for your reply. This is how the SaveData method in the controller looks like:
[HttpPost]
public ActionResult SaveData()
{
GridModel gridModel = new GridModel();
List<Transaction<Employee>> transactions = gridModel.LoadTransactions<Employee>…
(HttpContext.Request.Form["ig_transactions"]);
// here im getting the changes of the employee table. This works fine
//But how do I get the changes of my company?
foreach (Transaction<Employee> t in transactions)
{
//do something..
}
JsonResult result = new JsonResult();
Dictionary<string, bool> response = new Dictionary<string, bool>();
response.Add("Success", true);
result.Data = response;
return result;
}
I tryed putting the input element inside the curly brackets of the form, but it didnt work.
This is how my complete view looks like:
<!– Ignite UI Required Combined CSS Files –>
<link href="http://cdn-na.infragistics.com/igniteui/2016.1/latest/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" type="text/css" />
<link href="http://cdn-na.infragistics.com/igniteui/2016.1/latest/css/structure/infragistics.css" rel="stylesheet" type="text/css" />
<script src="http://ajax.aspnetcdn.com/ajax/modernizr/modernizr-2.8.3.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.min.js" type="text/javascript"></script>
<!– Ignite UI Required Combined JavaScript Files –>
<script src="http://cdn-na.infragistics.com/igniteui/2016.1/latest/js/infragistics.core.js" type="text/javascript"></script>
<script src="http://cdn-na.infragistics.com/igniteui/2016.1/latest/js/infragistics.lob.js" type="text/javascript"></script>
<!– Used to add modal loading indicator for igGrid –>
<script src="http://www.igniteui.com/js/grid-modal-loading-inicator.js"></script>
@using Infragistics.Web.Mvc
@model WebApplication1.Models.Company
@{
ViewBag.Title = "Index";
}
<h2>Edit – Company</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
<div class="form-group">
@Html.LabelFor(model => model.CompanyName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.CompanyName, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Address, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Address, new { htmlAttributes = new { @class = "form-control" } })
</div>
</div>
</div>
<hr />
<hr />
<h2>Employee List</h2>
@(Html.Infragistics()
.Grid(Model.EmployeeList).ID("Grid").Width("100%").Height("150px").PrimaryKey("ID")
.AutoGenerateColumns(false).AutoGenerateLayouts(false).EnableHoverStyles(false)
.Columns(column =>
{
column.For(x => x.FirstName).HeaderText("First Name").Width("40%");
column.For(x => x.LastName).HeaderText("Last Name").Width("40%");
})
.Features(features =>
{
features.Updating().ColumnSettings(cs =>
{
}).EnableAddRow(false).EnableDeleteRow(false);
})
.UpdateUrl(Url.Action("SaveData"))
.DataBind()
.Render()
)
<input type="button" id="saveChanges" class="button-style" value="Save" />
}
<script>
var updates, loadingIndicator;
$(function () {
var grid = $("#Grid"), comboDataSource = {};
$("#saveChanges").igButton({ labelText: $("#saveChanges").val(), disabled: false });
loadingIndicator = new GridModalLoadingIndicator(grid);
$("#saveChanges").on('igbuttonclick',
function (e) {
grid.igGrid("saveChanges", function saveSuccess() {
loadingIndicator.hide();
});
loadingIndicator.show();
return false;
}
);
});
</script>