Trying to figure out why when I double click on the row the modal dialog displays empty data fields.
<script type="text/javascript"> $("#grid1").live("iggridupdatingdatadirty", function (event, ui) { $("#grid1").igGrid("saveChanges"); return false; }); </script> <h2>Grid</h2> <p> @Html.ActionLink("Create New", "Create") </p> @( Html.Infragistics().Grid(Model).ID("grid1") .PrimaryKey("TypeID") .AutoGenerateColumns(false) .AutoGenerateLayouts(false) .Virtualization(false) .LocalSchemaTransform(true) .RenderCheckboxes(true) .Columns(column => { column.For(x => x.TypeID).DataType("string").HeaderText("ID"); column.For(x => x.TypeDescription).DataType("string").HeaderText("Description"); column.For(x => x.AddedBy).DataType("string").HeaderText("Added By"); column.For(x => x.DateAdded).DataType("date").HeaderText("Date Added"); column.For(x => x.ModifiedBy).DataType("string").HeaderText("Modified By"); column.For(x => x.DateModified).DataType("date").HeaderText("Date Modified"); column.For(x => x.DisplayOrder).DataType("string").HeaderText("Order number"); column.For(x => x.Enabled).DataType("string").HeaderText("Enabled"); }) .Features(features => { features.Sorting().Type(OpType.Local); features.Paging().PageSize(30).Type(OpType.Local); features.Selection().Mode(SelectionMode.Row); features.Updating().EnableAddRow(true).EnableDeleteRow(true) .EditMode(GridEditMode.RowEditTemplate) .RowEditDialogContainment("owner") .RowEditDialogWidth("300px") .RowEditDialogHeight("200px") .RowEditDialogOkCancelButtonWidth("100px") .RowEditDialogFieldWidth("150px") .ShowReadonlyEditors(true) .RowEditDialogRowTemplateID("rowEditDialogRowTemplate") .ColumnSettings(settings => { settings.ColumnSetting().ColumnKey("TypeID").ReadOnly(true); settings.ColumnSetting().ColumnKey("AddedBy").ReadOnly(true); settings.ColumnSetting().ColumnKey("DateAdded").ReadOnly(true); settings.ColumnSetting().ColumnKey("ModifiedBy").ReadOnly(true); settings.ColumnSetting().ColumnKey("DateModified").ReadOnly(true); settings.ColumnSetting().ColumnKey("TypeDescription").EditorType(ColumnEditorType.Text).TextEditorOptions(options => options.ValidatorOptions(option => { option.KeepFocus(ValidatorKeepFocus.Never); option.BodyAsParent(false); option.Required(true); })); settings.ColumnSetting().ColumnKey("Enabled").EditorType(ColumnEditorType.Text).TextEditorOptions(options => options.ValidatorOptions(option => { option.KeepFocus(ValidatorKeepFocus.Never); option.BodyAsParent(false); option.Required(true); })); }); }) .DataBind() .Height("500px") .Width("100%") .Render())
the database was created by someone else and they set the that key to string (I don't know why) but when I changed the database to int, everything displays correctly. Thanks!My issue now is that when I make changes, it updates the grid but not the data source can you help me with this?
Sorry if these are stupid questions, I'm new to this.
Hi,
I see that you defined TypeID column to be your primary key and you also defined it as a string type.
Row edit template fields will be empty if TypeID column values are number, but the column is defined as string, because there will be type mismatch when Row edit template ties to find the record from the data source.
Hope this helps,
Martin Pavlov
Infragistics, Inc.