Insert option row in Radgrid not rendering after inserting an item .

2 posts, 0 answers
  1. vikash
    vikash avatar
    2 posts
    Member since:
    Jul 2013

    Posted 20 Jun 2019 Link to this post

    Hi . 

    I am having a radgrid with having  3 EditItemTemplate which uses 2 Combobox  and one RadTextBox . When the page is loaded for first time the insert/Add section on top of the grid is available . But after first insertion only the item binded is shown in the grid . The add section is not rendered . However on delete command the Add section reapper and I am able to add the items but then again on adding item insert row vanishes . 

     

    I am providing the code of .ascx and code behind below . Kindly help as it is stuck for quite long time .

     

      <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxyReasonReflight" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="GrdReasonReflight">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="GrdReasonReflight" LoadingPanelID="DefaultLoadingPanel"
                            UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>          
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>

        <asp:Panel ID="Panel1" runat="server" Style="padding: 5px;">
           <div style="margin-top: 0px">
                 You have 
                    <telerik:RadNumericTextBox ID="TxtTotalOnBoardValue" runat="server" EnableViewState="true" MinValue="0" Value="0" Width="20">
                        <NumberFormat DecimalDigits="0" />
                        <IncrementSettings InterceptArrowKeys="false" InterceptMouseWheel="false" />
                    </telerik:RadNumericTextBox>
                 reasons for reflight from A/C Follow up.                                   
             </div>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <telerik:RadGrid ID="GrdReasonReflight" runat="server"  AutoGenerateColumns="false"
                AllowMultiRowSelection="false" Width="100%" OnPreRender="GrdReasonReflight_PreRender"
                OnItemCommand="GrdReasonReflight_ItemCommand" OnItemDataBound="GrdReasonReflight_ItemDataBound"
                OnNeedDataSource="GrdReasonReflight_NeedDataSource">
                <ValidationSettings ValidationGroup="GrpValReasonReflight" CommandsToValidate="PerformInsert,Update"
                    EnableValidation="true" />
                <MasterTableView EditMode="InPlace" InsertItemDisplay="Top"
                    EnableNoRecordsTemplate="false" DataKeyNames="TemporaryId">
                    <NoRecordsTemplate></NoRecordsTemplate>
                    <Columns>

                          <telerik:GridTemplateColumn UniqueName="Details" HeaderText="Details" AllowFiltering="false">
                            <ItemStyle Width="40%" />
                            <HeaderStyle Width="40%" />
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "AdditionalDetail")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadTextBox runat="server" ID="Details" Text='<%# Bind("AdditionalDetails") %>' MaxLength="50" Rows="2" TextMode="MultiLine" EmptyMessage="Enter details" 
                                    Width="95%" onfocus="focusOnInsertButton(this);" Visible="true" ValidationGroup="GrpValReasonReflight">
                                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="ValAdditionalDetail" runat="server" ControlToValidate="Details" Display="None"
                                    ErrorMessage="Required field." ValidationGroup="GrpValReasonReflight"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>

                         <telerik:GridTemplateColumn UniqueName="Category" HeaderText="Category" ItemStyle-Width="400px">
                            <ItemStyle Width="20%" />
                            <HeaderStyle Width="20%" />
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "CategoryName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadComboBox runat="server" ID="CmbCrewCategory" DropDownWidth="150" DataTextField="ReasonCategoryName" EmptyMessage="Select a Reason Category"  
                                    DataValueField="IdReasonCategory" Filter="StartsWith" HighlightTemplatedItems="true" 
                                    Width="99%"  AllowCustomText="true" OnClientKeyPressing="OnGrdCrewsCmbCrewTrigramKeyPressing"
                                    OnClientTextChange="OnTrigramClientTextChange" ValidationGroup="GrpValReasonReflight"
                                    OnClientFocus="RadCombobox_OnFocus"  AutoPostBack="true"
                                    EnableLoadOnDemand="true"  OnItemsRequested="CmbCategory_ItemsRequested"  OnSelectedIndexChanged="CmbCategory_BoundToReason">
                                    <ItemTemplate>
                                        <asp:Label ID="LblCmbCategoryNameTrigram" runat="server"><%# Eval("ReasonCategoryName") %></asp:Label>
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>


                     <telerik:GridTemplateColumn UniqueName="Reason" HeaderText="Reason" ItemStyle-Width="400px">
                            <ItemStyle Width="20%" />
                            <HeaderStyle Width="20%" />
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "ReasonName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                 <telerik:RadComboBox runat="server" ID="CmbCrewReason" DropDownWidth="150" DataTextField="ReasonName" EmptyMessage="Select a reason" 
                                    DataValueField="IdReason" Filter="StartsWith" HighlightTemplatedItems="true" 
                                    Width="99%"  AllowCustomText="true" OnClientKeyPressing="OnGrdCrewsCmbCrewTrigramKeyPressing"
                                    OnClientTextChange="OnTrigramClientTextChange" ValidationGroup="GrpValReasonReflight"
                                    OnClientSelectedIndexChanged="OnTrigramClientSelectedIndexChanged" OnClientFocus="RadCombobox_OnFocus" EnableLoadOnDemand="true">
                                    <ItemTemplate>
                                        <asp:Label ID="LblCmbCrewTrigram" runat="server"><%# Eval("ReasonName") %></asp:Label>
                                    </ItemTemplate>
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                      
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"  
                            EditImageUrl="~/Content/images/Edit.gif">
                            <ItemStyle HorizontalAlign="Center" Width="15%" />
                            <HeaderStyle Width="15%" />
                        </telerik:GridEditCommandColumn>

                        <telerik:GridButtonColumn UniqueName="DeleteCommandColumn" CommandName="Delete" ButtonType="ImageButton" ImageUrl="~/Content/images/delete.png"
                            ConfirmText="Are you sure you want to delete this crew member?">
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                            <HeaderStyle Width="5%" />
                        </telerik:GridButtonColumn>

                    </Columns>
                </MasterTableView>
                <ClientSettings>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                    <ClientEvents OnRowDblClick="GrdReasonReflightRowDblClick" OnCommand="GrdReasonReflight_OnCommand" />
                    <KeyboardNavigationSettings EnableKeyboardShortcuts="true" AllowSubmitOnEnter="true" ValidationGroup="GrpValReasonReflight" />
                </ClientSettings>       
            </telerik:RadGrid>
        </asp:Panel>

     

     

     

     

     

     

     

     

  2. Attila Antal
    Admin
    Attila Antal avatar
    520 posts

    Posted 24 Jun 2019 Link to this post

    Hi Vikash,

    I would like to see how the insert item is created at first in the code behind. Perhaps the same approach is used when firing the delete command and  is not used when inserting a record.

    The answer must be in the server-side code. It would be very helpful for me if you could share the server side code so that I can see how the items are manipulated.

    Kind regards,
    Attila Antal
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top