This is a migrated thread and some comments may be shown as answers.

Rad Ajax Panel & Validation Controls

1 Answer 74 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ganesh
Top achievements
Rank 1
Ganesh asked on 18 May 2015, 02:18 PM

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

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 21 May 2015, 08:09 AM
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
Tags
Ajax
Asked by
Ganesh
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or