Rad Ajax Panel & Validation Controls

2 posts, 0 answers
  1. Ganesh
    Ganesh avatar
    5 posts
    Member since:
    May 2012

    Posted 18 May 2015 Link to this post

    In my application i have one grid with following itemtemplate column

      <telerik:RadGrid ID="gvContainerDetail" runat="server" AllowPaging="True" CellSpacing="0"
                                                GridLines="None" AutoGenerateColumns="false" OnItemCommand="gvContainerDetail_ItemCommand"
                                                OnItemDataBound="gvContainerDetail_ItemDataBound">
                                                <FilterMenu EnableImageSprites="False">
                                                </FilterMenu>
                                                <ClientSettings>
                                                    <Selecting CellSelectionMode="None" AllowRowSelect="True" />
                                                </ClientSettings>
                                                <MasterTableView>
                                                    <Columns>
                                                        <telerik:GridTemplateColumn HeaderText="Container Type" DataField="ContainerType"
                                                            HeaderStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <telerik:RadComboBox ID="cbContainerType" Height="100px" Width="200px" runat="server"
                                                                    ItemsPerRequest="10" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                                    EnableAutomaticLoadOnDemand="False" AccessKey="T" MarkFirstMatch="true" EmptyMessage="Select"
                                                                    HighlightTemplatedItems="true">
                                                                </telerik:RadComboBox>
                                                                <asp:Label ID="lblContainrtTypeId" runat="server" Text='<%#Eval("nContainerId") %>'></asp:Label>
                                                                <asp:RequiredFieldValidator ID="rfvcbContainerType" runat="server" ControlToValidate="cbContainerType"
                                                                    ForeColor="Red" ValidationGroup="vgBooking" Display="none" EnableClientScript="true">
                                                                </asp:RequiredFieldValidator>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="No Of Container" UniqueName="Container" DataField="ContainerNo">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="txtContainer" Text='<%#Eval("NoOfContainer") %>' Width="200px"
                                                                    runat="server" MaxLength="10" MinValue="1" MaxValue="2147483647">
                                                                    <NumberFormat GroupSeparator="" DecimalDigits="0" />
                                                                </telerik:RadNumericTextBox>
                                                                <span style="color: Red; font-weight: normal; font-size: 20px; vertical-align: middle;">
                                                                    *</span>
                                                                <asp:RequiredFieldValidator ID="rfvtxtContainer" runat="server" ControlToValidate="txtContainer"
                                                                    ForeColor="Red" ValidationGroup="vgBooking" Display="none" EnableClientScript="true">
                                                                </asp:RequiredFieldValidator>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn UniqueName="Container" HeaderStyle-HorizontalAlign="Center">
                                                            <ItemTemplate>
                                                                <telerik:RadButton ID="btnAddContainer" Width="100px"
                                                                    runat="server" Text="+" Font-Bold="True" OnClick="btnAddContainer_Click">
                                                                </telerik:RadButton>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                </MasterTableView>
                                            </telerik:RadGrid>

    and one submit button

     <telerik:RadButton ID="btnsubmit " Width="100px" runat="server" Text="Submit"
                                                            Font-Bold="True" OnClick="btnsubmit _Click" ValidationGroup="vgBooking">
                                                        </telerik:RadButton>

     and ajax manager is

     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

    <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnAddContainer">
                    <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="gvContainerDetail" > </telerik:AjaxUpdatedControl>
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

     

    after clicking on submit button first time validation works properly and if i click on '+' button in grid one row is added in grid the ajax is works correctly but problem is that if i am clicked on again submit button the client side validation in grid is not working the page is post back

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 21 May 2015 Link to this post

    Hi Ganesh,

    Can you please try to add a setting in which the RadGrid update itself like this:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
     
    <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnAddContainer">
                    <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="gvContainerDetail" > </telerik:AjaxUpdatedControl>
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="gvContainerDetail">
                    <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="gvContainerDetail" > </telerik:AjaxUpdatedControl>
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

    and see how it goes.

    Regards,
    Maria Ilieva
    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