Hello folks,
There is someone that could explain me why a webcombo linked to a webgrid column, return into the webgrid column, the desciption (DataTextField) instead of the code (DataValueField).
Here it's m y code initiating the combo and linking it to the webgrid column.
Me.cboCurrency.DataSource = MyData.Tables(tblCombo) Me.cboCurrency.DataTextField = MyData.Tables(tblCombo).Columns(1).ColumnName Me.cboCurrency.DataValueField = MyData.Tables(tblCombo).Columns(0).ColumnName Me.cboCurrency.DataBind() Me.cboCurrency.Columns(0).Hidden = True Me.cboCurrency.Columns(1).Width = Unit.Pixel(200) Me.cboCurrency.Columns(1).Header.Caption = Resources.Labels.NameLabel Me.cboCurrency.Columns(2).Width = Unit.Pixel(50) Me.cboCurrency.Columns(2).Header.Caption = Resources.Labels.Symbol Me.grdMain.DisplayLayout.Bands(0).Columns.FromKey("CurrencyCd").Type = ColumnType.DropDownList Me.grdMain.DisplayLayout.Bands(0).Columns.FromKey("CurrencyCd").EditorControlID = Me.cboCurrency.UniqueID
By the way, this code works fine with NA 2007.3 (CLR2.0). It may be a new property that I didn't see, but the doc has the same samples in both version.
Thanks all,
Pierre
I would report this to Developer Support. This definitely sounds wrong.
OK, I have managed to come up with a workaround for this:
Add a hidden column, also bound to CustomerID, to the grid.
Add a client event handler for the WebCombo's AfterSelectChanged event, which saves the data value to a global variable:
function CustomerIDCombo_AfterSelectChange(webComboId){ var combo = igcmbo_getComboById(webComboId); newComboValue = combo.getValue();}
Add a client event handler for the WebGrid's AfterCellUpdate event, which sets the value hidden column for the correct row to the value you saved from the combo:
function UltraWebGrid1_AfterCellUpdateHandler(gridName, cellId){ var cell = igtbl_getCellById(cellId); if(newComboValue) { var row = cell.getRow() var hiddenCell = row.getCellFromKey("HiddenCustomerID"); hiddenCell.setValue(newComboValue, false); newComboValue = null; }}
And then you can reset the value of the real CustomerID field in the server-side UpdateRow event handler:
protected void UltraWebGrid1_UpdateRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { string customerID = e.Row.Cells.FromKey("HiddenCustomerID").Value.ToString(); e.Row.Cells.FromKey("CustomerID").Value = customerID; }
Far from perfect, but it does appear to do the job.
Yes, I'm finding exactly the same problem with the CLR2.0 build of 2008.1 - no matter what combination of settings I try, I'm always getting the value of the DataTextField returned instead of the DataValueField. Not hugely inspiring when evaluating a new piece of software...
Can anybody offer any insight?