Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
185
How can I generate primaryKey on igGrid?
posted

Hi. I define my igGrid in this way:

@( Html.Infragistics().Grid<BoletaDetalleView>()

     .ID("igGridDetalle")
     .RowTemplate("<tr><td> ${ApellidoNombre}</td><td>${CUIL}</td>" +
     "<td>${MotivoBajaDescripcion}</td>" +
     "<td>${AfiliadoId}</td>" +
     "<td>${PersonalId}</td>" +
     "<td>${BoletaId}</td>" +
     "<td>${MotivoBajaId}</td>" +
     "<td>${ID}</td>" +
     "<td>${Remuneracion}</td></tr>")
.PrimaryKey("ID")
.Columns(column =>
     {

     column.For(x => x.ApellidoNombre).DataType("string").HeaderText("Apellido Nombre").Width("50%");
     column.For(x => x.CUIL).DataType("int").HeaderText("CUIL").Width("20%");
     column.For(x => x.MotivoBajaDescripcion).HeaderText("Motivo Baja").Width("20%");
     column.For(x => x.Remuneracion).DataType("number").HeaderText("Remuneracion").Width("10%");
     column.For(x => x.AfiliadoId).DataType("int").Hidden(true);
     column.For(x => x.PersonalId).DataType("int").Hidden(true);
     column.For(x => x.BoletaId).DataType("int").Hidden(true);
     column.For(x => x.MotivoBajaId).DataType("int").Hidden(true);
     column.For(x => x.ID).DataType("int").HeaderText("ID").Hidden(true);

    })

    .Features(features =>

      {
       features.Sorting().Mode(SortingMode.Single).ColumnSettings(settings =>
             {
             settings.ColumnSetting().ColumnKey("ID").AllowSorting(true);

             });
       features.Selection().MouseDragSelect(true).MultipleSelection(false).Mode(SelectionMode.Row);
       features.Updating().ColumnSettings(settings =>
             {
             settings.ColumnSetting()
            .ColumnKey("MotivoBajaDescripcion")
            .Required(false)
            .EditorType(ColumnEditorType.Combo)
            .ComboEditorOptions(options =>
                           {
                           options.TextKey("Descripcion");
                           options.ValueKey("ID");
                           options.DataSource(ViewBag.MotivosBaja);
                           options.DropDownMinHeight(200);
                           });
          });

})

.ClientDataSourceType(ClientDataSourceType.JSON)
.DataSource(new List<BoletaDetalleView>().AsQueryable())
.Width("100%")
.AutoCommit(false)
.DataBind()
.Render()
)

How can I generate primary  key when adding a row?