This question is locked. New answers and comments are not allowed.
Hi,
I'm using Ajax grid editing in a master/detail grid. So, my master grid use editing and my detail view also. I have a special column bound to complex type (like employee.ascx, showing a dropdownlist) in you samples. Almost all works fine except that when I'm going in editing mode in my detail view (where my special column is), the value is not selected in dropdownlist. The drop down is correctly feed, but the selection does not work.
Here is the code, my EditorTemplate is Role.ascx and my column bound is called Role
When I add alert to debug code, I see that my first alert is lauched, but not the second one and I don't understand why.
could you please help me?
Thank you
I'm using Ajax grid editing in a master/detail grid. So, my master grid use editing and my detail view also. I have a special column bound to complex type (like employee.ascx, showing a dropdownlist) in you samples. Almost all works fine except that when I'm going in editing mode in my detail view (where my special column is), the value is not selected in dropdownlist. The drop down is correctly feed, but the selection does not work.
Here is the code, my EditorTemplate is Role.ascx and my column bound is called Role
<script type="text/javascript"> // find the dropdown first var $dropdown = $('#Role'); $('<option/>', { text: '<none>', value: -1 }) .prependTo($dropdown); // find the table row (tr) which is being edited var $tr = $dropdown.closest('tr:has(form)'); // get the grid client object var grid = $tr.closest('.t-grid').data('tGrid'); // get the data item bound to this table row var dataItem = grid.dataItem($tr); // set the value of the dropdown to select the proper item $dropdown.val(dataItem.Role ? dataItem.Role.RoleId : -1); </script>When I add alert to debug code, I see that my first alert is lauched, but not the second one and I don't understand why.
<script type="text/javascript"> alert($('#Role')); // find the dropdown first var $dropdown = $('#Role'); alert($('#Role')); $('<option/>', { text: '<none>', value: -1 }) .prependTo($dropdown); // find the table row (tr) which is being edited var $tr = $dropdown.closest('tr:has(form)'); // get the grid client object var grid = $tr.closest('.t-grid').data('tGrid'); // get the data item bound to this table row var dataItem = grid.dataItem($tr); // set the value of the dropdown to select the proper item $dropdown.val(dataItem.Role ? dataItem.Role.RoleId : -1); </script>could you please help me?
Thank you