Current filter:
                                You should refresh the page.
                                  • Hello

                                    I have a GridViewDataComboBoxColumn that is edited in an Edit Form Template. How can I clear the value (e.g. set selected index to -1)?

                                    The column is defined as:

                                    [HTML]
                                    <dx:GridViewDataComboBoxColumn Caption="Nomination Group" FieldName="nominationGroup" Visible="False" Name="nominationGroup" VisibleIndex="9" Width="400px"> <PropertiesComboBox TextField="nominationGroup" NullText="Select Nomination Group (Optional)" ValueField="id" Width="350px"> </PropertiesComboBox> </dx:GridViewDataComboBoxColumn>

                                    The Edit Form is defined as:

                                    [HTML]
                                    <tr> <td class="fieldName" style="text-align: right"> <dx:ASPxLabel ID="ASPxLabel7" runat="server" Text="Nomination Group:" Wrap="False"> </dx:ASPxLabel> </td> <td> <dx:ASPxGridViewTemplateReplacement ID="selectNominationGroup" ReplacementType="EditFormCellEditor" runat="server" ColumnID="nominationGroup" /> </td> </tr>

                                    The data is provided by:

                                    [VB.NET]
                                    ElseIf e.Column.FieldName = "nominationGroup" Then Dim comboN As ASPxComboBox = TryCast(e.Editor, ASPxComboBox) Dim lSG = From l In ldb.tblSecurityGroupLinks Join g In ldb.tblSecurityGroups On l.groupID Equals g.id Where l.linkType = "ET" And l.groupRights = "E" And l.linkedRecord = e.KeyValue.ToString And Not adsu.Contains(l.groupID) And Not kdr.Contains(l.groupID) And Not modAdmin.Contains(g.id) Order By g.groupName Select New With {g.id, g.groupName} comboN.DataSource = lSG comboN.TextField = "groupName" comboN.ValueField = "id" comboN.DataBind() Dim val As Object = dgEventTypes.GetRowValuesByKeyValue(e.KeyValue, "nominationGroup") If val = 0 Then comboN.SelectedIndex = -1 End If

                                    Note:  for brevity I have remove some of the VB code to define the filters.

                                    If I delete the current selected value it reverts to the previous value.

                                    Thanks
                                    James

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,
                                To resolve the issue, set the ASPxComboBox.AllowNull property to True or display the 'Clear' button using the ClearButton.DisplayMode property.

                                [ASPx]
                                <PropertiesComboBox AllowNull="true" ... > <ClearButton DisplayMode="OnHover"></ClearButton>

                                Please let me know if this helps.

                                • James Organ 11.14.2019

                                  Thanks!

                                • Nataly (DevExpress Support) 11.14.2019

                                  You are aways welcome!

                                • James Organ 11.17.2019

                                  Thanks for that.