RadGrid Master-Detail with Insert on Detail Table.. How to?

1 Answer 166 Views
Ajax Grid
Scott
Top achievements
Rank 1
Iron
Iron
Scott asked on 20 Sep 2023, 07:41 PM

Hi,

Long time Webforms developer here, but just starting out with Telerik Rad controls.

I can't for the life of me figure out how to get the "Insert Record" button to show up on my Grid that has a Master-Detail relationship.

I looked at the code sample and can't figure out what I am missing.

Any help you could provide would be appreciated.


<telerik:RadGrid ID="gvCurrentSalaries" runat="server" AllowPaging="True" DataSourceID="sqlCurrentSalaries" PageSize="50" Visible="False" RenderMode="Lightweight" AllowSorting="True" AllowAutomaticInserts="True" AutoGenerateColumns="False" OnInsertCommand="gvCurrentSalaries_InsertCommand">
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>

            <ExportSettings ExportOnlyData="True" FileName="Workforce-Salary" IgnorePaging="True">
                <Excel FileExtension="xlsx" Format="Xlsx" />
            </ExportSettings>
            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                <Selecting AllowRowSelect="True" />
            </ClientSettings>

<MasterTableView CommandItemDisplay="Top" DataSourceID="sqlCurrentSalaries" DataKeyNames="PersonID">
    <DetailTables>
        <telerik:GridTableView runat="server" DataKeyNames="PersonID" DataSourceID="sqlSalaryHistory">
            <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="PersonID" MasterKeyField="PersonID" />
            </ParentTableRelation>
            <RowIndicatorColumn ShowNoSortIcon="False" Visible="False">
            </RowIndicatorColumn>
            <ExpandCollapseColumn Created="True" ShowNoSortIcon="False">
            </ExpandCollapseColumn>
            <EditFormSettings>
                <EditColumn ShowNoSortIcon="False">
                </EditColumn>
            </EditFormSettings>
            <Columns>
                <telerik:GridBoundColumn DataField="Salary" FilterControlAltText="Filter FullName column" HeaderText="Current Salary" ShowNoSortIcon="False" UniqueName="Salary" DataFormatString="{0:c}">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="StartDate" FilterControlAltText="Filter FullName column" HeaderText="Start Date" ShowNoSortIcon="False" UniqueName="StartDate" DataFormatString="{0:d}">
                </telerik:GridBoundColumn>
    </Columns>
        </telerik:GridTableView>
    </DetailTables>
    
    <CommandItemSettings ShowExportToExcelButton="True" ShowExportToPdfButton="True" ShowAddNewRecordButton="False" />
<RowIndicatorColumn ShowNoSortIcon="False" Visible="False"></RowIndicatorColumn>

<ExpandCollapseColumn ShowNoSortIcon="False" Created="True"></ExpandCollapseColumn>

    <Columns>
        <telerik:GridBoundColumn DataField="FullName" FilterControlAltText="Filter FullName column" HeaderText="Full Name" ShowNoSortIcon="False" UniqueName="FullName">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="PersonType" FilterControlAltText="Filter FullName column" HeaderText="Person Type" ShowNoSortIcon="False" UniqueName="PersonType">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Salary" FilterControlAltText="Filter FullName column" HeaderText="Current Salary" ShowNoSortIcon="False" UniqueName="Salary" DataFormatString="{0:c}">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="StartDate" FilterControlAltText="Filter FullName column" HeaderText="Start Date" ShowNoSortIcon="False" UniqueName="StartDate" DataFormatString="{0:d}">
        </telerik:GridBoundColumn>
    </Columns>

<EditFormSettings>
<EditColumn ShowNoSortIcon="False"></EditColumn>
</EditFormSettings>
</MasterTableView>
            <HeaderStyle Font-Bold="True" HorizontalAlign="Left" />

<FilterMenu RenderMode="Lightweight"></FilterMenu>

<HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
        </telerik:RadGrid>

1 Answer, 1 is accepted

Sort by
0
Scott
Top achievements
Rank 1
Iron
Iron
answered on 21 Sep 2023, 02:31 PM

Ok... figured it out.

CommandItemDisplay must be set for the Detail... which of course isn't in the wizard.... 

you must navigate...

MasterTableView->DetailTables->CommandItemDisplay

Tags
Ajax Grid
Asked by
Scott
Top achievements
Rank 1
Iron
Iron
Answers by
Scott
Top achievements
Rank 1
Iron
Iron
Share this question
or