martes, 30 de septiembre de 2014

algo mvvm

<%@ Page Title="" Language="C#" MasterPageFile="~/Layout.Master" AutoEventWireup="true" CodeBehind="Formulario.aspx.cs" Inherits="SCPServicio.admin.Formulario" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="SidebarContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    var listInstructores = <%= gridValuesInstructores%>;   
</script>
    <h1>Capacitaciones programadas</h1>
    <div id="instructorGrid">
    </div>
    <div id="form-container">
        <div class="selector">
           Instructor: <select data-role="dropdownlist"
           data-value-field="value"
           data-text-field="text"
           data-bind="source: listInstructores, value: idOperador, events: { change: changeLocationSpanText }"
           data-option-label="seleccione un instructor"
           data-value-primtive="true"
           style="width:300px"></select>
         </div>
    </div>   
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsContent" runat="server">
<script>
    "use strict";
    $(function () {     
        var viewModel = kendo.observable({
            listInstructores: listInstructores,
            changeLocationSpanText: function (e) {
                if (e.sender.dataItem().value === "")
                    return false;
                alert(e.sender.dataItem().value)
            }

        });
        kendo.bind($("#form-container"), viewModel);
    });
</script>
</asp:Content>

No hay comentarios:

Publicar un comentario