This question is locked. New answers and comments are not allowed.
Hello,
if i add a new line in my grid, the dropdownlist will always have the value from the first line. how can i set this value manually?
I have the following EditorTemplate
The only way for validation ( with the RequiredAttrbiute ) is to let the value an empty string. is this the best way?
Regards,
Timo
if i add a new line in my grid, the dropdownlist will always have the value from the first line. how can i set this value manually?
I have the following EditorTemplate
<%= Html.DropDownList( null, new SelectList( ( IEnumerable )ViewData["karnofskyEcogTypes"], "KarnofskyEcogTypeId", "LongDescription" ), new { style = "width: 90%;" } )%> <script type="text/javascript"> var $dropdown = $('#KarnofskyEcogType'); $('<option/>', { text: '...', value: "" }).prependTo($dropdown); var $tr = $dropdown.closest('tr:has(form)'); var grid = $tr.closest('.t-grid').data('tGrid'); var dataItem = grid.dataItem($tr); $dropdown.val(dataItem.KarnofskyEcogType ? dataItem.KarnofskyEcogType.KarnofskyEcogTypeId : ""); </script>The only way for validation ( with the RequiredAttrbiute ) is to let the value an empty string. is this the best way?
Regards,
Timo