<%@ 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">
<h1>Administración de Instructores</h1>
<div id="instructorGrid">
</div>
<div id="form-container">
<div class="selector">
Instructor: <select data-role="dropdownlist" data-value-field="idinstructor" data-text-field="ins_apellido_paterno" data-bind="source: instructor" data-option-label="seleccione un instructor"></select>
</div>
</div>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ScriptsContent" runat="server">
<script>
"use strict";
$(function () {
var intructoresDataSource = new kendo.data.DataSource({
transport: {
create: {
url: "/Servicio.svc/instructores",
type: "POST",
contentType: "application/json; charset=utf-8"
},
read: "/Servicio.svc/instructores",
update: {
url: "/Servicio.svc/instructores",
type: "POST",
contentType: "application/json; charset=utf-8"
},
parameterMap: function (data, operation) {
if (operation == "update" || operation == "create") {
return kendo.stringify(data);
}
return data;
}
},
schema: {
data: "Data",
total: "Count",
model: {
id: "idinstructor",
fields: {
idinstructor: { editable: false, defaultValue: 0 },
ins_nombre: { editable: true, nullable: false, validation: { required: { message: "{0} es requerido"}} },
ins_apellido_paterno: { editable: true, nullable: false, validation: { required: { message: "{0} es requerido"}} },
ins_apellido_materno: { editable: true, nullable: false, validation: { required: { message: "{0} es requerido"}} }
}
}
},
pageSize: 15,
serverPaging: true
});
var viewModel = kendo.observable({
instructor: intructoresDataSource
});
kendo.bind($("#form-container"), viewModel);
$("#instructorGrid").kendoGrid({
columns: [
{ field: "ins_nombre", title: "Nombre" },
{ field: "ins_apellido_paterno", title: "Apellido Paterno" },
{ field: "ins_apellido_materno", title: "Apellido Materno" },
{ command: [tr.edit, tr.destroy], title: "" }
],
dataSource: intructoresDataSource,
pageable: true,
editable: { mode: "inline", confirmation: tr.confirmation },
sortable: true,
toolbar: [tr.create]
});
});
</script>
</asp:Content>
No hay comentarios:
Publicar un comentario