Hi,
I am migrating from old UltraWinGrid (10.2) to WebDataGrid (20.1.20201.24) but I having problem on how to proceed.
My project Grids have frequently many Columns with WebCombo inside and each one has a visible "Text" and a hidden "Value" (both string).I would need to get the "Value" set by user, when saving page, by reading the Grid update with a loop on "rows" and "columns" and read a Cells (server side in C # code) to write them in a recordset.
The DropDown value obtained, once saved on the recordset, in a new Grid DataBind, should load the DropDown displaying the relative Text.This procedure worked with old UltraWebGrids.
CmbValueField = Grid.Rows[Rig].Items[Col].Value.ToString(); (Value sample)
CmbTextField = Grid.Rows[Rig].Items[Col].Text; (Text sample)
Instead, using the WebDataGrid and setting the Grid Column as "BoundDataField" (string) and adding an editor DropDownEditorProvider I can only obtain by code the displayed Text of the DropDown.By making a different selection on the DropDown and reading the new "Value" server side, I always get the value loaded at the first Grid databind: all user changes are ignored.How can I proceed to get the correct "value"?This is my Grid:
<ig:WebDataGrid ID="Grid" runat="server" AutoGenerateColumns="False" EnableDataViewState="True" EnableRelativeLayout="True" BorderWidth="0px" Height="435px" Width="745px"> <Columns> <ig:BoundDataField DataFieldName="KKK" DataType="System.Int32" Hidden="True" HtmlEncode="False" Key="KKK" Width="20px"> <Header Text="KKK" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="X99V" DataType="System.Int32" Hidden="True" HtmlEncode="False" Key="X99V" Width="20px"> <Header Text="X99V" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="KC02" DataType="System.String" HtmlEncode="False" Key="KC02" Width="40px"> <Header Text="KC02" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="C02Y" DataType="System.String" HtmlEncode="False" Key="C02Y" Width="200px"> <Header Text="C02Y" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="C02Z" DataType="System.String" HtmlEncode="False" Key="C02Z" Width="200px"> <Header Text="C02Z" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="WC01" HtmlEncode="True" Key="WC01" Width="140px" DataType="System.String"> <Header Text="WC01" /> </ig:BoundDataField> <ig:UnboundCheckBoxField HeaderChecked="False" Key="Del" HeaderCheckBoxMode="Off" Width="20px" CssClass="igg_CheckBoxAlignCentrer"> </ig:UnboundCheckBoxField> </Columns> <EditorProviders> <ig:TextEditorProvider ID="Grid_TextEditor_KC02"> <EditorControl ID="EditorControl1" runat="server" CssClass="igg_EditCell"> </EditorControl> </ig:TextEditorProvider> <ig:TextEditorProvider ID="Grid_TextEditor_C02Y"> <EditorControl ID="EditorControl2" runat="server" CssClass="igg_EditCell"> </EditorControl> </ig:TextEditorProvider> <ig:TextEditorProvider ID="Grid_TextEditor_C02Z"> <EditorControl ID="EditorControl3" runat="server" CssClass="igg_EditCell"> </EditorControl> </ig:TextEditorProvider> <ig:DropDownProvider ID="Grid_Cmb_WC01" StretchHeight="True" > <EditorControl ID="EditorControl4" runat="server" CssClass="igdd_GTComboInGrid" DropDownOffsetX="3" TextField="Valore" ValueField="Chiave" ClientIDMode="Predictable"> <Button DisabledImageUrl="../../Images/Combo/Style1/btn_comboGrid_disabled.gif" HoverImageUrl="../../Images/Combo/Style1/btn_comboGrid_normal.gif" ImageUrl="../../Images/Combo/Style1/btn_comboGrid_normal.gif" PressedImageUrl="../../Images/Combo/Style1/btn_comboGrid_pressed.gif" /> <DropDownItemBinding TextField="Valore" ValueField="Chiave"></DropDownItemBinding> </EditorControl> </ig:DropDownProvider> </EditorProviders> <Behaviors> <ig:Activation> </ig:Activation> <ig:EditingCore AutoCRUD="False" BatchUpdating="True"> <Behaviors> <ig:CellEditing> <ColumnSettings> <ig:EditingColumnSetting ColumnKey="KC02" EditorID="Grid_TextEditor_KC02" ReadOnly="True" /> <ig:EditingColumnSetting ColumnKey="C02Y" EditorID="Grid_TextEditor_C02Y" /> <ig:EditingColumnSetting ColumnKey="C02Z" EditorID="Grid_TextEditor_C02Z" /> <ig:EditingColumnSetting ColumnKey="WC01" EditorID="Grid_Cmb_WC01" /> </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:CellEditing> <ig:RowAdding> <ColumnSettings> <ig:RowAddingColumnSetting ColumnKey="KC02" EditorID="Grid_TextEditor_KC02" /> <ig:RowAddingColumnSetting ColumnKey="C02Y" EditorID="Grid_TextEditor_C02Y" /> <ig:RowAddingColumnSetting ColumnKey="C02Z" EditorID="Grid_TextEditor_C02Z" /> <ig:RowAddingColumnSetting ColumnKey="WC01" EditorID="Grid_Cmb_WC01" /> </ColumnSettings> <EditModeActions MouseClick="Single" /> </ig:RowAdding> </Behaviors> </ig:EditingCore> <ig:RowSelectors> </ig:RowSelectors> </Behaviors> </ig:WebDataGrid>
Thanks in advance.
Hello Andrea,
After investigating this further, I determined that the value and the text of the cell with dropdown as editor provider could be accessed in a method bound to the OnRowUpdated event. In the method the cell with the dropdown of the updated row is accessed and the text and value are saved in a variable as follows:
var index = (int)e.RowID["index"];
var comboValue = wdg.Rows[index].Items[1].Value;
var comboText = wdg.Rows[index].Items[1].Text;
Below I am attaching a sample, demonstrating the described behavior. Please test it on your side and let me know if you need additional information regarding this matter.
Regards, Monika Kirkova, Infragistics
6874.WebDataGridDropDownProvider.zip
I am glad that you find my suggestion helpful and were able to access the text and value of the updated cell.
Thank you for using Infragistics components.