This is a migrated thread and some comments may be shown as answers.

[Solved] binding not working if OnEdit is used

0 Answers 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Samantha
Top achievements
Rank 1
Samantha asked on 27 May 2012, 07:23 AM
Hi

Not sure why it wont work if I try to use OnEdit event. Everything is OK when I remove the ".ClientEvents(c => c.OnEdit("OnEditing")) "


here's my code
@(Html.Telerik().Grid<Expense>()
    .DataBinding(dataBinding => dataBinding.Ajax()
        .Select("GetOrders", "ExpenseEntry")
        .Update("UpdateOrder", "ExpenseEntry")
    )
    .ClientEvents(c => c.OnEdit("OnEditing"))
    .Name("ExpensesGrid")
        .DataKeys(keys => keys.Add(r => r.ExpenseID)
        .RouteKey("ExpenseID"))
    .Columns(columns =>
        {
            columns.Bound(r => r.ExpenseID);
            columns.ForeignKey(o => o.ItemCategoryID, (System.Collections.IEnumerable)ViewData["Categories"],
                        "ItemCategoryID", "CategoryName").Title("Category").Width(300);
            columns.ForeignKey(o => o.ItemID, (System.Collections.IEnumerable)ViewData["Items"],
                        "ItemID", "ItemName").Title("Item").Width(300);
            columns.Bound(r => r.Description);
            columns.Bound(r => r.Amount);
            columns.Command(commands =>
                commands.Edit()
            );
        })
         )
    
    <script type="text/javascript">
        function onEditing(e) {
            //get the first combobox in the edit form
            var categoryCombobox = $(e.form).find('#ItemCategoryID');            
        }                
    </script>
Tags
Grid
Asked by
Samantha
Top achievements
Rank 1
Share this question
or