Infragistics Web Grid. Adding a PrimaryKey for the AddNewRow

When you initialize a new row on the grid for a data source that includes a primary key, the generatePrimaryKeyValue event of igGrid Updating feature is raised to provide a primary key value to the new row. The second parameter of the event handler includes the value member which is used to return the new primary key value back up to the grid. By default, the value is initialized with a value that is equal to the number of rows in the data source. The following code listing is an example of how to implement generating a new primary key value to a new row of the grid.

In Javascript:

function getTempKey(){

var key;

//This function gets the appropriate temporary key for a new row from the server

return key;




columns: [

{headerText:“Product ID”, key:“ProductID”, width: “100px” , dataType:“number”},

{headerText:“Product Name”, key:“Name”, width: “180px” , dataType:“string”}


dataSource: adventureWorks, primaryKey: ‘ProductID’,

features: [ {

name: ‘Updating’,

generatePrimaryKeyValue: function (evt, ui) {

// setting a temporary key for the new row

ui.value = getTempKey();


columnSettings: [ {

columnKey: “ProductID”,

editorOptions: {readOnly: true}

} ]

} ]



Pero mejor esta otra opción:

$(“#grid1”).live(“iggridupdatinggenerateprimarykeyvalue”, function (event, ui) {






Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión /  Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión /  Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión /  Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión /  Cambiar )


Conectando a %s