Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • ASPxGridView PopupEditForm does not showing error text / indication on UI

                                    Validation erros are forced in code, PopupEditForm is remains open.
                                    No indication is shown on UI.
                                    How validation errors from server-side should be made visible?

                                    Actual code snippets:

                                    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LanguageProfile.ascx.cs" Inherits="LanguageProfileControl" %>

                                    <%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                        Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
                                    <%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.1, Version=10.1.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
                                        Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

                                    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

                                    <cc1:CollapsiblePanelExtender ID="CollapsiblePanel10" runat="server" TargetControlID="displayPanel10"
                                        Collapsed="False" CollapsedSize="0" AutoCollapse="False" AutoExpand="False" ScrollContents="False"
                                        ImageControlID="ShowContent"
                                        CollapseControlID="ShowContent" ExpandControlID="ShowContent" Enabled="True" BehaviorID = "Language">
                                    </cc1:CollapsiblePanelExtender>

                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                            <td class="group" align="left"><%= BlockKeyText%></td>
                                              <td class="group" align="right">
                                                <asp:Image runat="server" ID="ShowContent" ImageUrl="~/Images/hide.gif"
                                                    ImageAlign="Top" />
                                            </td>
                                       </tr>
                                      </table>
                                    <asp:Panel ID="displayPanel10" runat="server" >
                                        <br />
                                        <br />
                                     
                                        <dx:ASPxGridView ID="LP_Grid" ClientInstanceName="LP_Grid" runat="server"
                                            AutoGenerateColumns="false"
                                            KeyFieldName="ID"
                                            OnRowUpdating="Grid_RowUpdating"
                                            OnRowInserting="Grid_RowInserting"
                                            OnRowDeleting="Grid_RowDeleting"
                                            OnRowValidating="Grid_RowValidating"
                                            Width="100%" >

                                            <Settings ShowFooter="True" />
                                            <SettingsBehavior ConfirmDelete="true" />

                                            <SettingsPager Mode="ShowAllRecords">
                                            </SettingsPager>
                                            
                                            <SettingsEditing
                                                Mode="PopupEditForm"
                                                NewItemRowPosition="Bottom"
                                                PopupEditFormWidth="600px"
                                                EditFormColumnCount="1"
                                                PopupEditFormAllowResize="True"
                                                PopupEditFormShowHeader="False" />
                                                            
                                            <Columns>
                                                <dx:GridViewCommandColumn Caption=" " Name="CommandColumn">
                                                    <EditButton Visible="True" />
                                                    <DeleteButton Visible="True" />
                                                    <FooterTemplate>
                                                        <dx:ASPxButton ID="AddNewButton" runat="server" Text="<%# AddBtnLbl %>" OnLoad="AddNewButton_Load" UseSubmitBehavior="false" AutoPostBack="false">
                                                            <ClientSideEvents Click="function(s, e) {LP_Grid.AddNewRow();}" />
                                                        </dx:ASPxButton>
                                                    </FooterTemplate>
                                                </dx:GridViewCommandColumn>

                                                <dx:GridViewDataTextColumn Caption="(LanguageName)"
                                                    FieldName="LanguageName" Name="LanguageName" Width="30%">
                                                    <PropertiesTextEdit>
                                                        <ValidationSettings CausesValidation="True" Display="Dynamic"
                                                            ValidationGroup="Container.ValidationGroup">
                                                            <RequiredField IsRequired="True" />
                                                        </ValidationSettings>
                                                    </PropertiesTextEdit>
                                                    <Settings AllowSort="True" />
                                                    <EditItemTemplate>
                                                        <asp:DropDownList ID="LanguageNameList" runat="server"
                                                            DataTextField="Name"
                                                            DataValueField="ID"
                                                            OnDataBound="ColLanguageNameList_DataBound"
                                                            ValidationGroup='<%# Container.ValidationGroup %>'
                                                            OnInit="ColLanguageNameList_Init">
                                                        </asp:DropDownList>
                                                    </EditItemTemplate>
                                                    <CellStyle Wrap="True">
                                                    </CellStyle>
                                                </dx:GridViewDataTextColumn>

                                                <dx:GridViewDataTextColumn Caption="(SpeakingProficiencyName)"
                                                    FieldName="SpeakingProficiencyName" Name="SpeakingProficiencyName" Width="30%">
                                                    <Settings AllowSort="True" />
                                                    <EditItemTemplate>
                                                        <asp:DropDownList ID="SpeakingProficiencyNameList" runat="server"
                                                            DataTextField="Name"
                                                            DataValueField="ID"
                                                            OnDataBound="ColSpeakingProficiencyNameList_DataBound"
                                                            OnInit="ColSpeakingProficiencyNameList_Init">
                                                        </asp:DropDownList>
                                                    </EditItemTemplate>
                                                    <CellStyle Wrap="True">
                                                    </CellStyle>
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            
                                        </dx:ASPxGridView>

                                        <br />
                                        <br />

                                     </asp:Panel>

                                            protected void Grid_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
                                            {
                                                //if (e.NewValues["LanguageName"] != null && e.NewValues["LanguageName"].ToString().Length == 0)
                                                {
                                                    AddError(e.Errors, LP_Grid.Columns["LanguageName"], "Is required field.");
                                                }

                                                //if (e.NewValues["SpeakingProficiencyName"] != null && e.NewValues["SpeakingProficiencyName"].ToString().Length == 0)
                                                {
                                                    AddError(e.Errors, LP_Grid.Columns["SpeakingProficiencyName"], "Is required field.");
                                                }

                                            }

                                            private void AddError(Dictionary<GridViewColumn, string> errors, GridViewColumn column, string errorText)
                                            {
                                                if (errors.ContainsKey(column)) return;
                                                errors[column] = errorText;
                                            }

                                0

                                Hi Anton,

                                A possible solution here is to call the ASPxGridView.DoRowValidation method in the ASPxGridView.StartRowEditing event handler.
                                This will validate the row currently being edited.

                                Thanks,
                                Alex

                                0

                                Hi,

                                The problem not with data validation code.
                                The problem is that validation results are not shown in PopupEditForm. (but form stays open)

                                So I am back with issue
                                     ASPxGridView PopupEditForm does not showing error text / indication on UI

                                Is there any sample for PopupEditForm and data validation results shown on UI?

                                Thanks,
                                   Anton

                                0

                                Hi Anton,

                                Thank you for the clarification. It looks like we have already discussed a similar situation. You will find a possible solution in the following thread:

                                Validation not working for normal asp controls in devexpress gridview's popupeditform.

                                Should you need further clarification, feel free to ask. I will be glad to help you.

                                Thanks,
                                Alex

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners