Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Web/Views/Shared/EditorTemplates/Ponente.cshtml @ 219:b9850b647a4e
Agregando alta de ponente durante la carga del evento
author | nelopauselli |
---|---|
date | Thu, 08 Sep 2011 11:22:10 -0300 |
parents | e6e6bfb1da9e |
children | de6d206bd5c3 |
comparison
equal
deleted
inserted
replaced
218:cc1ed131c9e6 | 219:b9850b647a4e |
---|---|
1 @model Guid | 1 @model Guid |
2 @Html.DropDownList(string.Empty, Html.GetPonentes(Model)) | 2 <script type="text/javascript"> |
3 $(document).ready(function () { | |
4 $("#agregarPonente").subpanel({ successful: recargar, confirmButton: "Agregar", action: '/PersonaApi/Nueva' }); | |
5 }); | |
6 | |
7 function recargar(data) { | |
8 if (data.Succeful) { | |
9 // obtenemos el dropdown | |
10 var ponentes = $("#Ponente"); | |
11 | |
12 // agregamos el ponente | |
13 var opcion = $("<option></option>").attr("value", data.Id).html(data.Nombre).appendTo(ponentes); | |
14 | |
15 // ordenamos los ponentes | |
16 var options = $("option", ponentes); | |
17 | |
18 options.sort(function (a, b) { | |
19 if (a.text > b.text) return 1; | |
20 else if (a.text < b.text) return -1; | |
21 else return 0 | |
22 }) | |
23 | |
24 ponentes.empty().append(options); | |
25 | |
26 // seleccionamos el ponente que acabamos de agregar | |
27 ponentes.attr("value", data.Id); | |
28 } | |
29 else { | |
30 alert(data.Message); | |
31 return false; | |
32 } | |
33 } | |
34 | |
35 </script> | |
36 @Html.DropDownList(string.Empty, Html.GetPonentes(Model), new { style = "vertical-align: top;" }) | |
37 <div id="agregarPonente" style="display: inline-block"></div> |