Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
Read DropDown ValueField in WebDataGrid Cell
posted

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.