I have a grid having an column mapped to EmailTypeId in model whose editor type is defined as Combo. Now when I select the value from Combo, It's displayed as numeric (EmailTypeId) in grid. is there anything as (ValueLists in Netadvantage for winform) which could set the EmailTypeId to the selected EmailType in the grid. I need EmailTypeId to Save and EmailType to display on the grid.
@(Html.Infragistics().Grid(Of Advantage.Web.EmailAcct) _ .ID("grid1") _ .AutoGenerateColumns(False) _ .Columns(Function(columns) columns.For(Function(c) c.EmailId).HeaderText("Email ID").DataType("number").Hidden(True) columns.For(Function(c) c.EmailAddress).HeaderText("Email Address").DataType("String").Width(300) columns.For(Function(c) c.EmailTypeId).HeaderText("Email Type").DataType("number") columns.For(Function(c) c.isDefault).HeaderText("Default").DataType("bool") End Function) _ .Features(Function(features) features.Sorting().CaseSensitive(False).Mode(SortingMode.Single).Type(OpType.Local) features.Resizing() features.Filtering.Type(OpType.Local).Mode(FilterMode.Simple) features.Selection().Mode(SelectionMode.Row).MultipleSelection(False) features.Updating().AddRowLabel("Add Email").AddRowTooltip("Add Email").EditMode(GridEditMode.Row).ColumnSettings(Function(column) column.ColumnSetting.ColumnKey("EmailTypeId").EditorType(ColumnEditorType.Combo).ComboEditorOptions(Function(combo) combo.Mode(ComboMode.DropDown).SelectItemBySpaceKey(True).EnableClearButton(False).DropDownOnFocus(True).TextKey("EmailType").ValueKey("EmailTypeId").DataSource(ViewData("EmailTypes")) End Function) End Function) End Function) _ .AutoCommit(True) _ .RenderCheckboxes(True) _ .DataSource(ViewData("EmailAccts")) _ .DefaultColumnWidth("100") _ .Width("100%") _ .Height("200") _ .DataBind() _ .Render())
Hi,
You can use column formatter function and lookup the EmailType by EmailTypeId.
First you need to build dictionary object for the lookup function which will contain EmailTypeId as a property name and EmailType as a property value. You can get the combo data source with igGridUpdating API.
Here is an example function:
This function takes a global object as argument and fills it with the combo data source data.
Next, define a lookup function which will get the EmailTypeId and will return EmailType.
In this function lookupProductList is a global object which was filled by fillProductNameLookup function.
Finally bind formatter function to EmailTypeId column by using the igGrid.columns.formatter property.
Here is an example code:
Attached you can find a sample demonstrating the described solution.
Hope this helps,
Martin Pavlov
Infragistics, Inc.
To anyone coming to this later it's worth noting that in this loop:
the i's should actually be j's
Thanks a lot! it works.