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

How to rebind child Grid & allow batch edits in Master Grid ?

2 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 18 Sep 2017, 05:10 PM

I have my Master & Child grid code setup as below.

The problem is I want to refresh my child grid when users clicks on row & at the same time allow users to do batch edits in the master grid (& later in Child Grid also).

In line23 below:

If I add, EnablePostBackOnRowClick="true" in order to rebind the child grid then the cursor lose the position in Master Grid.

If I remove the EnablePostBackOnRowClick then Child Grid do not show up.

01.<body>
02.    <form id="form1" runat="server">
03.    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
04.    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
05.    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="false">
06.        <AjaxSettings>
07.            <telerik:AjaxSetting AjaxControlID="RadGrid1">
08.                <UpdatedControls>
09.                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
10.                    <telerik:AjaxUpdatedControl ControlID="grdMySearches" />
11.                </UpdatedControls>
12.            </telerik:AjaxSetting>
13.        </AjaxSettings>
14.    </telerik:RadAjaxManager>
15.    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel>
16.    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" DecoratedControls="All" EnableRoundedCorners="false" />
17.    <div id="demo" class="demo-container no-bg">
18.        <h3>WorkPack Header:</h3>
19.        <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True"
20.            AllowAutomaticInserts="True" PageSize="10" OnItemDeleted="RadGrid1_ItemDeleted"
21.            OnItemUpdated="RadGrid1_ItemUpdated" OnPreRender="RadGrid1_PreRender" AllowAutomaticUpdates="True" AllowPaging="True"
22.            AutoGenerateColumns="False" OnBatchEditCommand="RadGrid1_BatchEditCommand" DataSourceID="SqlDataSource1">
23.            <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
24.                <Selecting AllowRowSelect="true"></Selecting>
25.            </ClientSettings>
26.            <MasterTableView DataKeyNames="ID" EditMode="Batch" CommandItemDisplay="Top" >
27.               <BatchEditingSettings EditType="Cell" />
28.                <Columns>
29.                    <telerik:GridBoundColumn DataField="WP_Name" HeaderStyle-Width="210px" HeaderText="WP_Name" SortExpression="WP_Name" UniqueName="WP_Name">
30.                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
31.                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
32.                            </RequiredFieldValidator>
33.                        </ColumnValidationSettings>
34.                    </telerik:GridBoundColumn>
35.                    <telerik:GridBoundColumn DataField="Status" HeaderStyle-Width="210px" HeaderText="Name" SortExpression="Status" UniqueName="Status">
36.                        <ColumnValidationSettings EnableRequiredFieldValidation="true">
37.                            <RequiredFieldValidator ForeColor="Red" Text="*This field is required" Display="Dynamic">
38.                            </RequiredFieldValidator>
39.                        </ColumnValidationSettings>
40.                    </telerik:GridBoundColumn>
41.                    <telerik:GridButtonColumn ConfirmText="Delete this ID?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px"
42.                        CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
43.                    </telerik:GridButtonColumn>
44.                </Columns>
45.            </MasterTableView>
46.            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
47.        </telerik:RadGrid>
48.        <br />
49.        <h3>WorkPack Details:</h3>
50.        <telerik:RadGrid ID="grdMySearches" DataSourceID="dsMySearches" runat="server" Skin="Windows7" AutoGenerateColumns="False"
51.          OnItemCommand="grdMySearches_ItemCommand"  OnItemDeleted="grdMySearches_ItemDeleted"  OnItemDataBound = "grdMySearches_ItemDataBound" AllowPaging="True" AllowSorting="True"  GridLines="None">
52.           <MasterTableView DataSourceID="dsMySearches"  HierarchyDefaultExpanded="true" CommandItemDisplay="None" AllowAutomaticInserts="false"  AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" PageSize="25" Width="100%">
53.                <CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="false" ShowAddNewRecordButton="false"  ShowRefreshButton="false"/>   
54.                <NoRecordsTemplate>
55.                        No documents were selected for this package
56.                </NoRecordsTemplate>
57.                <Columns>
58.                    <telerik:GridBoundColumn DataField="ID"  HeaderText="ID"  SortExpression="ID" UniqueName="ID" AllowFiltering="false" Visible="false" />   
59.                    <telerik:GridBoundColumn DataField="GUID" HeaderText="FileNet Unique ID" UniqueName="GUID"/>
60.                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"></telerik:GridEditCommandColumn>
61.                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmText="Do you want to remove this search?" UniqueName="DeleteCommandColumn" ButtonType="ImageButton" />
62.                </Columns>
63.           </MasterTableView>
64.            <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
65.                <Selecting AllowRowSelect="true"></Selecting>
66.            </ClientSettings>
67.            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
68.        </telerik:RadGrid>
69. 
70.    </div>
71.    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ appSettings:DBConnectionString %>"
72.        DeleteCommand="DELETE FROM [Products] WHERE [ID] = @ID"
73.        SelectCommand="SELECT [ID], [WP_Path], [WP_Name], [Status], [WP_Type], [WP_DT] FROM OxyDocs_WorkPack_Header where UserID like '%haldanks%'"
74.        UpdateCommand="UPDATE [OxyDocs_WorkPack_Header] SET [WP_Name] = @WP_Name, [Status] = @Status WHERE [ID] = @ID">
75.        <DeleteParameters>
76.            <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
77.        </DeleteParameters>
78.        <UpdateParameters>
79.            <asp:Parameter Name="WP_Name" Type="String"></asp:Parameter>
80.            <asp:Parameter Name="Status" Type="String"></asp:Parameter>
81.            <asp:Parameter Name="ID" Type="Int32"></asp:Parameter>
82.        </UpdateParameters>
83.    </asp:SqlDataSource>
84.    <asp:SqlDataSource ID="dsMySearches" runat="server"
85.        ConnectionString="<%$ appSettings:DBConnectionString %>"
86.        DeleteCommand="DELETE FROM OxyDocs_WorkPack_Detail WHERE [ID] = @ID"
87.        SelectCommand="SELECT ID, GUID, FolderPath, Message from OxyDocs_WorkPack_Detail where Header_ID = @ID">
88.       <DeleteParameters>
89.            <asp:Parameter Name="ID"  Type="Int32" />
90.        </DeleteParameters>
91.       <SelectParameters>
92.            <asp:ControlParameter ControlID="RadGrid1" Name="ID" PropertyName="SelectedValue" Type="String"></asp:ControlParameter>
93.        </SelectParameters>
94.    </asp:SqlDataSource>
95.    </form>
96.</body>

2 Answers, 1 is accepted

Sort by
0
Andy
Top achievements
Rank 1
answered on 20 Sep 2017, 02:40 PM
Any suggestions?
0
Andy
Top achievements
Rank 1
answered on 20 Sep 2017, 03:06 PM
Is there a way after rebind I can focus back on the cell used clicked on?
Tags
Grid
Asked by
Andy
Top achievements
Rank 1
Answers by
Andy
Top achievements
Rank 1
Share this question
or