@model IEnumerable<FlexGridData.Sale>

<h1>
    Editing Events
</h1>
<p>
    FlexGrid has several events related to editing.
</p>
<p>
    This example shows how you can use two of them:
</p>
<ul>
    <li>
        <b>beginningEdit</b>:
        Prevent editing overdue items by setting the <b>cancel</b>
        parameter to true.
    </li>
    <li>
        <b>cellEditEnding</b>:
        Prevent entering negative amounts for the 'sales' and
        'expenses' columns.
    </li>
</ul>
<div id="log">
    &nbsp;
</div>
@(Html.C1().FlexGrid().Id("theGrid").Height(200)
    .AutoGenerateColumns(false)
    .Bind(Model)
    .Columns(cs =>
    {
        cs.Add().Binding("Id").Header("ID").Width("50").IsReadOnly(true);
        cs.Add().Binding("Country").Header("Country").IsRequired(true);
        cs.Add().Binding("Sales").Header("Sales").Format("n2");
        cs.Add().Binding("Expenses").Header("Expenses").Format("n2");
        cs.Add().Binding("Overdue").Header("Overdue");
    })
)