This question is locked. New answers and comments are not allowed.
Hello,
I have a grid ajax binded in batch edit mode. In my model I have an integer field which is not a foreign key, it's just an integer to represent one of three status. I did a editor template with a dropdownlist and I populated with three items statically (1-Status 1, 2- Status 2 and 3- Status 3). I also decorated the integer field of my model with a UIHint with the same name that the editor template.
Finally, I added this code to handle the on edit event of the row and to match the the integer Id with the value field of the dropdownlist:
The problem #1 is that during "no edition mode", the integer number is shown in the column and when I clicked on it the onEdit field is fired and the corresponding Id in the dropdownlist is selected and here comes the #2 problem: when the row exits the edition mode the dropdownlist dissapears and the integer field appears again.
The probem #1 was easy to solve, I changed the plain integer field with an object field containing the Value and the Text and I added a client template like this:
columns.Bound(c => c.ObjectField)
.ClientTemplate("<#= ObjectField.Text #>")
Now I solved the first problem, so I can see the Texts in the column's Grid and when clicking on to edit the dropdownlist sucessfully choses the corresponding item but the problem #2 still exists, so after changing the item selection in the list and clicking in other row (I mean, after exiting edition mode) the same colum Text appears again and the dropdownlist selection is gone.
I have spent 3 days with this, so I have tried many forum answers with no results, I have downloaded sample code but most of the samples matches string fields with dropdownlists or foreign integer fields with another table.
Thank you in advance,
I have a grid ajax binded in batch edit mode. In my model I have an integer field which is not a foreign key, it's just an integer to represent one of three status. I did a editor template with a dropdownlist and I populated with three items statically (1-Status 1, 2- Status 2 and 3- Status 3). I also decorated the integer field of my model with a UIHint with the same name that the editor template.
Finally, I added this code to handle the on edit event of the row and to match the the integer Id with the value field of the dropdownlist:
function onEdit(e) {
$(e.form).find('#drowndownId).data('tDropDownList').select(
function (dataItem) {
if (dataItem.Value == e.dataItem['objectIntegerField']) {
return true;
}
else
return false;
});
}
The problem #1 is that during "no edition mode", the integer number is shown in the column and when I clicked on it the onEdit field is fired and the corresponding Id in the dropdownlist is selected and here comes the #2 problem: when the row exits the edition mode the dropdownlist dissapears and the integer field appears again.
The probem #1 was easy to solve, I changed the plain integer field with an object field containing the Value and the Text and I added a client template like this:
columns.Bound(c => c.ObjectField)
.ClientTemplate("<#= ObjectField.Text #>")
Now I solved the first problem, so I can see the Texts in the column's Grid and when clicking on to edit the dropdownlist sucessfully choses the corresponding item but the problem #2 still exists, so after changing the item selection in the list and clicking in other row (I mean, after exiting edition mode) the same colum Text appears again and the dropdownlist selection is gone.
I have spent 3 days with this, so I have tried many forum answers with no results, I have downloaded sample code but most of the samples matches string fields with dropdownlists or foreign integer fields with another table.
Thank you in advance,