Telerik RadGrid open in popup when AllowMultiRowEdit="True"

2 posts, 0 answers
  1. Manfred
    Manfred avatar
    1 posts
    Member since:
    Feb 2014

    Posted 09 May Link to this post

    Hello experts... I need help please.

    I have a RadGrid with multiple row edit... I want to open all checked Items in a popup when I click the edit button.

    I thought I do it with <NestedViewTemplate> or with another RadGrid2. I have no idea about how do I solve this problem. Can you please give me feedback.

    Here is my short code:

    <telerik:RadGrid ID="myGrid" Skin="Silk" AutoGenerateColumns="false" AllowAutomaticUpdates="true"
    OnNeedDataSource="myGrid_NeedDataSource" AllowPaging="True" PageSize="10" AllowMultiRowSelection="True" AllowMultiRowEdit="True"
    ShowStatusBar="true" AllowFilteringByColumn="true" runat="server">    
            <MasterTableView DataKeyNames="Title" Name="myGridView" EnableHeaderContextMenu="true" ItemStyle-Wrap="False" CommandItemDisplay="Top" Width="100%" >
                <Columns>
                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn" AllowFiltering="false" HeaderStyle-Width="2%" >
                          <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection"
                              AutoPostBack="True" />
                          </ItemTemplate>
                          <HeaderTemplate>
                            <asp:CheckBox ID="headerChkbox" runat="server" OnCheckedChanged="ToggleSelectedState"
                              AutoPostBack="True" />
                          </HeaderTemplate>
                 </telerik:GridTemplateColumn>   
                    
                <telerik:GridBoundColumn UniqueName="Title" DataField="Title" HeaderText="Title" HeaderStyle-Width="15%" FilterControlAltText="Title" ReadOnly="true">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBox1" runat="server" Height="200px" Width="100%"                      
                         AllowCustomText="true" AutoPostBack="true" EnableLoadOnDemand="true" MarkFirstMatch="true"
                         DataValueField="Id" DataTextField="Title" OnSelectedIndexChanged="RadComboBox1_IndexChanged"
                         CheckBoxes="true" AppendDataBoundItems="true" EmptyMessage="Select..." CheckedItemsTexts="DisplayAllInInput"
                          SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Title").CurrentFilterValue %>' >                      
                        </telerik:RadComboBox>                         
                    </FilterTemplate>
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="Price" HeaderText="Price" HeaderStyle-Width="65%" AllowFiltering="false">
                </telerik:GridBoundColumn>

                <telerik:GridBoundColumn DataField="Order" HeaderText="Order" AllowFiltering="false">
                </telerik:GridBoundColumn>
            </Columns>             
                <NestedViewTemplate>
                    <telerik:RadGrid RenderMode="Lightweight" runat="server" ID="editGrid" ShowFooter="true"
                                    AllowSorting="false" EnableLinqExpressions="false">
                                    <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true"
                                        DataKeyNames="Title" PageSize="7" HierarchyLoadMode="ServerOnDemand">
                                        <DetailTables>
                                            <telerik:GridTableView Name="editView" AutoGenerateColumns="false" DataKeyNames="Title" DataSourceID="Title"
                                                Width="100%" CommandItemSettings-ShowRefreshButton="false" >                                            
                                                <Columns>
                                                    <telerik:GridBoundColumn SortExpression="Price" HeaderText="Price" HeaderButtonType="TextButton"
                                                        DataField="Price" UniqueName="Price">
                                                    </telerik:GridBoundColumn>                                                
                                                    <telerik:GridBoundColumn SortExpression="Order" HeaderText="Order" HeaderButtonType="TextButton"
                                                        DataField="Order" UniqueName="Order">
                                                    </telerik:GridBoundColumn>                                             
                                                </Columns>
                                               <%-- <SortExpressions>
                                                    <telerik:GridSortExpression FieldName="Title" SortOrder="Descending"></telerik:GridSortExpression>
                                                </SortExpressions>--%>
                                            </telerik:GridTableView>
                                        </DetailTables>                                    
                                    </MasterTableView>
                                    <ClientSettings AllowDragToGroup="true">
                                        <Scrolling AllowScroll="true" ScrollHeight="" />
                                    </ClientSettings>
                                    <PagerStyle PageButtonCount="3" Mode="NextPrevAndNumeric" ShowPagerText="false" />
                                </telerik:RadGrid>
                 </NestedViewTemplate>
            <CommandItemTemplate>
               <asp:LinkButton Style="vertical-align: bottom" ID="btnEditSelected" runat="server" OnClick="EditSelected_Click" CommandName="EditSelected" Visible='<%# myGrid.EditIndexes.Count == 0 %>'><img style="border:0px" alt="" src="/_layouts/images/Telerik/Edit.png" /> Edit Selected</asp:LinkButton>&nbsp;&nbsp;       
               <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" Visible='<%# myGrid.EditIndexes.Count > 0 %>'><img style="border:0px" alt="" src="/_layouts/images/Telerik/Update.png" /> Update Items</asp:LinkButton>&nbsp;&nbsp;
               <asp:LinkButton ID="btnCancel" runat="server" CommandName="CancelAll" Visible='<%# myGrid.EditIndexes.Count > 0 || myGrid.MasterTableView.IsItemInserted %>'><img style="border:0px" alt="" src="/_layouts/images/Telerik/Cancel.png" /> Cancel editing</asp:LinkButton>&nbsp;&nbsp;                   
               <asp:LinkButton ID="LinkButton6" runat="server" CommandName="RebindGrid"><img style="border:0px" alt="" src="/_layouts/images/Telerik/Refresh.png" /> Refresh table</asp:LinkButton>&nbsp;&nbsp;
                   <br />
             </CommandItemTemplate>
        </MasterTableView>
        <ClientSettings EnablePostBackOnRowClick="true" ClientEvents-OnPopUpShowing="PopUpShowing" >
            <Selecting AllowRowSelect="True" EnableDragToSelectRows="True"></Selecting>
        </ClientSettings>
    </telerik:RadGrid>

     

     

    private void EditSelected_Click(object sender, EventArgs e)
    {

    ????

    }

     

    when I checked Items it shold come the checked Items in Popup and edit.

     

    I would be glad about your help.

    Thanks a lot.

     

     

     

     

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 12 May Link to this post

    Hi,

    Please check out the following examples:
       Batch Server Update    
       Performing Batch Updates
       http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/shareddatepicker/defaultcs.aspx?product=grid

    I hope this will prove helpful.

    Regards,
    Maria Ilieva
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top