Multiple RadGrid on same page, GridEditCommandColumn PerformInsert mode requiredfield validators Issue

2 posts, 0 answers
  1. Kunal
    Kunal avatar
    6 posts
    Member since:
    Aug 2014

    Posted 12 Aug 2015 Link to this post

    We have similar two radgrids like below in one page. When we try to insert empty data clicking on insert it shows requiredfiled validator which is correct but it triggers requiredfield validator of 2nd grid also because it is also in edit mode. How to keep it separate so that validation for one grid should not call validation for 2nd grid if both are in edit/Insert mode.

     

    <telerik:RadGrid ID="c_dgvMClassificationCode" AllowPaging="true" PageSize="5" AllowCustomPaging="true"
            runat="server"AllowFilteringByColumn="False"GridLines="None"AutoGenerateColumns="False"
            AllowSorting="True">
            <PagerStyle Visible="true"/>
            <ClientSettings AllowColumnsReorder="True"ReorderColumnsOnClient="True"EnableRowHoverStyle="True">
                <ClientEventsOnRowContextMenu="RowContextMenuMClassificationCode"/>
                <ScrollingAllowScroll="true"EnableVirtualScrollPaging="false" UseStaticHeaders="true"
                    SaveScrollPosition="true"/>
                <SelectingAllowRowSelect="true"/>
            </ClientSettings>
            <GroupingSettingsCaseSensitive="false"/>
            <MasterTableViewDataKeyNames="UniqueID"NoMasterRecordsText="No Master Classification Codes found."
                EditMode="InPlace"CommandItemDisplay="Top"GridLines="Both"TableLayout="Fixed"
                InsertItemPageIndexAction="ShowItemOnCurrentPage" Width="490">
                <CommandItemTemplate>
                    <divstyle="width: 80%; float: left; vertical-align: middle; height: 23px;">
                        <asp:Label ID="c_lblMclsCode"runat="server"Text="Master Classification Code" CssClass="gridHeaderLabels"></asp:Label>&nbsp;
                        <asp:ImageButton ID="c_ibtnAdd"CssClass="headerButtons"runat="server"ImageUrl="~/Images/addDocBtn.png"
                            CommandName="InitInsert1"ImageAlign="Middle"CausesValidation="false"></asp:ImageButton>
                        &nbsp;
                    </div>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridTemplateColumnSortAscImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortAsc.gif"
                        AllowFiltering="false"FilterImageUrl="~/App_Themes/Default/Grid/Skins/Vista/Filter.gif"
                        HeaderStyle-Width="30"UniqueName="UniqueID"SortDescImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortDesc.gif">
                        <ItemStyleHorizontalAlign="Center"VerticalAlign="Middle"Wrap="False"Width="30">
                        </ItemStyle>
                        <ItemTemplate>
                            <asp:ImageButton ID="c_ibtnActionMenu"runat="server"ImageUrl="~/Images/actionIcon.png"/>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridEditCommandColumnUniqueName="EditCommandColumn"HeaderStyle-Width="30px"
                        ButtonType="ImageButton"EditImageUrl="~/Images/actionIcon.png"CancelImageUrl="~/App_Themes/Default/Grid/Skins/Vista/cancelIcon.png"
                        UpdateImageUrl="~/App_Themes/Default/Grid/Skins/Vista/updateIcon.png"InsertImageUrl="~/App_Themes/Default/Grid/Skins/Vista/updateIcon.png">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn ReadOnly="True"SortAscImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortAsc.gif"
                        DataField="UniqueID"FilterImageUrl="~/App_Themes/Default/Grid/Skins/Vista/Filter.gif"
                       DataType="System.Int32"UniqueName="UniqueID"SortDescImageUrl="~/App_Themes/Default/Grid/Skins/Vista/SortDesc.gif"
                        HeaderText="UniqueID"Display="false"Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumnUniqueName="IndustryCodeDescription"HeaderText="Master Classification Code">
                        <ItemStyleHorizontalAlign="Left"VerticalAlign="Bottom"Wrap="True"></ItemStyle>
                        <ItemTemplate>
                            <%--<%#DataBinder.Eval(Container.DataItem, "IndustryCodeDescription")%>--%>
                            <img alt="Primary"src="~/images/TransparentdashSaveIcon.png"runat="server"id="imgPrimary"
                                style="border: 0px; padding: 0 5px 0 5px;"visible="false"/>
                            <asp:Literal ID="ltlIndustryCode"runat="server"Text='<%# DataBinder.Eval( Container, "DataItem.IndustryCodeDescription") %>' />
                        </ItemTemplate>
                        <EditItemTemplate>
                            <telerik:RadComboBox DataTextField="Description"DataValueField="IndustryCodeID"
                                ID="c_dgvrcbIndustryCodes"runat="server"Width="400px"EnableScreenBoundaryDetection="false"
                                Filter="Contains"MarkFirstMatch="false"ExpandDirection="Down"EmptyMessage="--Select One--"
                                CssClass="inputRequired"EnableTextSelection="true"EnableItemCaching="true"
                                EnableLoadOnDemand="true">
                            </telerik:RadComboBox>
                            <br />
                            <asp:RequiredFieldValidatorID="rfvrcbIndustryCode"runat="server"ControlToValidate="c_dgvrcbIndustryCodes"
                                ErrorMessage="Please Select Master Classification Code" ForeColor="red" Display="Dynamic"
                                SetFocusOnError="True"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridBoundColumn DataField="IndustryCodeID"DataType="System.Int32"UniqueName="IndustryCodeID"
                        HeaderText="IndustryCodeID"Display="false"Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="IsPrimary"DataType="System.Int32"UniqueName="IsPrimary"
                        HeaderText="IsPrimary"Display="false"Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="EntityID"DataType="System.Int32"UniqueName="EntityID"
                        HeaderText="EntityID"Display="false"Visible="false">
                    </telerik:GridBoundColumn>
                </Columns>
                <PagerTemplate>
                    <asp:Panel ID="c_pnlPager"Style="padding: 1px;" runat="server"HorizontalAlign="Center">
                        <p style="margin: 0px; padding: 0px;">
                            <asp:ImageButton ID="c_ibtnPagingFirst"ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingFirst.gif"
                                runat="server"OnClick="c_ibtnPagingFirst_click"ImageAlign="Middle"CommandName="Page"
                                CommandArgument="First"/>
                            <asp:ImageButton ID="c_ibtnPagingPrev" ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingPrev.gif"
                                runat="server"OnClick="c_ibtnPagingPrev_click"ImageAlign="Middle"CommandName="Page"
                                CommandArgument="Prev" />
                            <span style="vertical-align: middle;">Page:</span> <span style="vertical-align: middle;">
                                <%# CType(DataBinder.Eval(Container, "Paging.CurrentPageIndex"), Int32) + 1 %>&nbsp;</span>
                            <span style="vertical-align: middle;">of
                                <%# DataBinder.Eval(Container, "Paging.PageCount")%>
                            </span>
                            <asp:ImageButton ID="c_ibtnPagingNext_click"ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingNext.gif"
                                runat="server"OnClick="c_ibtnPagingNext_click"ImageAlign="Middle"CommandName="Page"
                                CommandArgument="Next"/>
                            <asp:ImageButton ID="c_ibtnPagingLast" ImageUrl="~/App_Themes/Default/Grid/Skins/Vista/img/PagingLast.gif"
                                runat="server"OnClick="c_ibtnPagingLast_Click"ImageAlign="Middle"CommandName="Page"
                                CommandArgument="Last"/>
                        </p>
                    </asp:Panel>
                </PagerTemplate>
            </MasterTableView>
        </telerik:RadGrid>

  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 14 Aug 2015 Link to this post

    Hi Kunal,

    I am sending a sample RadGrid web site to demonstrate how you can achieve the requested functionality. Please run the attached application and let me know if it helps you.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top