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

Add New Record Link not appearing for detail table in hierarchial grid

14 Answers 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 15 Feb 2009, 02:43 PM
Hi,

I am writing under the assumption that if you add a detail table to a master table, the detail table will have by default, the Add New Record link at the top left. I see this for my master table, but the detail table does not display any Add Record option and I need one. Any clues on what to look for? Thanks.

14 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Feb 2009, 04:31 AM
Hello Karl,

Try adding the CommandItemDisplay property for the detail table also as shown below:
aspx:
<telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="SqlDataSource1">  
    <MasterTableView DataSourceID="SqlDataSource1" CommandItemDisplay="Top" Name="Master">  
       <DetailTables>  
         <telerik:GridTableView DataSourceID="SqlDataSource1" CommandItemDisplay="Top"  Name="Detail" runat="server" >  
         .....  
 

Thanks
Princy.

0
Karl Wilkens
Top achievements
Rank 1
answered on 18 Mar 2009, 08:41 AM
Hi, thanks. That worked... but I just updated to Q1 2009 and now I have a 4 level deep hierarchy I am working on and no matter what, it does not display the add new record link. Here is what I am doing -

        <telerik:RadGrid ID="RadGrid1" runat="server" Skin="Web20" AutoGenerateColumns="False" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True">
                  <MasterTableView InsertItemDisplay="top"  >
                      <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                      <Columns>
                          <telerik:GridBoundColumn DataField="ProfileID" HeaderText="ID" UniqueName="column">
                          </telerik:GridBoundColumn>
                          <telerik:GridBoundColumn DataField="Name" HeaderText="Questionaire" UniqueName="column1">
                          </telerik:GridBoundColumn>
                      </Columns>
                      <DetailTables>
                          <telerik:GridTableView runat="server"  DataKeyNames="ProfileAreaID,ProfileID">
                              <ExpandCollapseColumn Visible="True">
                              </ExpandCollapseColumn>
                              <Columns>
                                  <telerik:GridBoundColumn DataField="Title" HeaderText="Title" UniqueName="column">
                                  </telerik:GridBoundColumn>
                                  <telerik:GridBoundColumn DataField="AreaListOrder" HeaderText="Order" UniqueName="AreaListOrder">
                                  </telerik:GridBoundColumn>
                              </Columns>
                              <DetailTables>
                                  <telerik:GridTableView runat="server" DataKeyNames="ProfileQuestionID,ProfileAreaID">
                                   <ParentTableRelation>
                                            <telerik:GridRelationFields DetailKeyField="ProfileAreaID"  MasterKeyField="ProfileAreaID" />
                                                </ParentTableRelation>
                                      <ExpandCollapseColumn Visible="True">
                                      </ExpandCollapseColumn>
                                      <Columns>
                                          <telerik:GridBoundColumn DataField="Title" HeaderText="Title" UniqueName="column">
                                          </telerik:GridBoundColumn>
                                              <telerik:GridBoundColumn DataField="QuestionType" HeaderText="Type" UniqueName="QuestionType">
                                          </telerik:GridBoundColumn>
                                              <telerik:GridBoundColumn DataField="QuestionStatement" HeaderText="Question Statement" UniqueName="QuestionStatement">
                                          </telerik:GridBoundColumn>
                                      </Columns>
                                      <DetailTables>
                                          <telerik:GridTableView runat="server" DataKeyNames="ProfileQuestionID">
                                          <ParentTableRelation>
                                            <telerik:GridRelationFields DetailKeyField="ProfileQuestionID"  MasterKeyField="ProfileQuestionID" />
                                                </ParentTableRelation>
                                              <Columns>
                                                  <telerik:GridBoundColumn DataField="ChoiceStatement" HeaderText="Choice" UniqueName="ChoiceStatement">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="ChoiceType" HeaderText="Type" UniqueName="Choicetype">
                                                  </telerik:GridBoundColumn>
                                                  <telerik:GridBoundColumn DataField="ChoiceListOrder" HeaderText="Order" UniqueName="ChoiceListOrder">
                                                  </telerik:GridBoundColumn>
                                              </Columns>
                                          </telerik:GridTableView>
                                      </DetailTables>
                                  </telerik:GridTableView>
                              </DetailTables>
                          </telerik:GridTableView>
                      </DetailTables>
                      <ExpandCollapseColumn Visible="True">
                      </ExpandCollapseColumn>
                  </MasterTableView>
                  <ClientSettings>
                      <Selecting AllowRowSelect="True" />
                  </ClientSettings>
              </telerik:RadGrid>
0
Sebastian
Telerik team
answered on 18 Mar 2009, 08:43 AM
Hi Karl,

You need to set the CommandItemDisplay property for each table view in the hierarchy (master or detail table) to a value different than None in order to display the Add new records/Refresh options in the header. I do not see that in the code snippet you provided.

Regards,
Sebastian
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Parimal
Top achievements
Rank 1
answered on 30 Aug 2010, 12:55 AM
Updating dll from 2008 to 2010 not showing commanditem for detail table. Is there any specific issue with new version or required to modify code.
0
Sebastian
Telerik team
answered on 30 Aug 2010, 09:52 AM
Hi Parimal,

This online example of RadGrid for ASP.NET AJAX uses the latest release of the suite (2010.2.826) and does not exhibit the issue with the command item for detail tables. Can you please outline the differences between your configuration and the one from the sample? They can lead us to the source of the discrepancy to eliminate it accordingly.

Regards,
Sebastian
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Parimal
Top achievements
Rank 1
answered on 07 Sep 2010, 11:24 PM
I have spend whole day to find problem into grid. I have updated project to the latest version of telerik and now showing version # 2010.2.826.35. Still not showing command button (add new record) into detail page. its show command button for parent record. Find attached file and can you find out what is the problem into and can you advice or fix the attached solution and reply back with working one.

Can you check with both dataset object.

Thanks Again
Parimal Patel



<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DaySaveResources_New.ascx.cs"
  Inherits="BSP2.Portal.UI.UserControls.DaySaveResources_New" %>
<table style="width: 100%;">
  <tr>
    <td>
      <telerik:RadGrid ID="RadGrid_New" runat="server" AutoGenerateHierarchy="True" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
        OnNeedDataSource="RadGrid1_NeedDataSource" ShowStatusBar="true" AllowAutomaticDeletes="True"
        AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateColumns="false"
        AutoGenerateDeleteColumn="false" AutoGenerateEditColumn="false"
        Skin="WebBlue">
<HeaderContextMenu EnableAutoScroll="True"></HeaderContextMenu>

        <mastertableview datakeynames="CustomerID" allowmulticolumnsorting="True" width="100%"
          commanditemdisplay="Top" name="Customers">
          <DetailTables>
            <telerik:GridTableView DataKeyNames="OrderID" Width="100%" runat="server" CommandItemDisplay="TopAndBottom"
              Name="Orders" AutoGenerateColumns="false" CommandItemSettings-ShowAddNewRecordButton="true">
              <ParentTableRelation>
                <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
              </ParentTableRelation>
              <Columns>
                <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"
                  DataField="OrderID" UniqueName="OrderID" ReadOnly="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered1" HeaderButtonType="TextButton"
                  DataField="OrderDate" UniqueName="OrderDate">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="RequiredDate" HeaderText="RequiredDate"
                  HeaderButtonType="TextButton" DataField="RequiredDate" UniqueName="RequiredDate">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton"
                  DataField="EmployeeID" UniqueName="EmployeeID">
                </telerik:GridBoundColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn2">
                  <HeaderStyle Width="20px" />
                  <ItemStyle CssClass="MyImageButton" />
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn ConfirmText="Delete these details record?" ButtonType="ImageButton"
                  CommandName="Delete" Text="Delete" UniqueName="DeleteColumn2">
                  <HeaderStyle Width="20px" />
                  <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                </telerik:GridButtonColumn>
              </Columns>
            </telerik:GridTableView>
          </DetailTables>
          <Columns>
            <telerik:GridBoundColumn SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
              DataField="CustomerID" UniqueName="CustomerID" ReadOnly="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
              DataField="ContactName" UniqueName="ContactName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
              DataField="CompanyName" UniqueName="CompanyName">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn SortExpression="Address" HeaderText="Address" HeaderButtonType="TextButton"
              DataField="Address" UniqueName="Address">
            </telerik:GridBoundColumn>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
              <HeaderStyle Width="20px" />
              <ItemStyle CssClass="MyImageButton" />
            </telerik:GridEditCommandColumn>
            <telerik:GridButtonColumn ConfirmText="Delete this customer?" ButtonType="ImageButton"
              CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
              <HeaderStyle Width="20px" />
              <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
            </telerik:GridButtonColumn>
          </Columns>
          <SortExpressions>
            <telerik:GridSortExpression FieldName="CompanyName"></telerik:GridSortExpression>
          </SortExpressions>
          <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
          <RowIndicatorColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
          </RowIndicatorColumn>
          <ExpandCollapseColumn>
            <HeaderStyle Width="20px"></HeaderStyle>
          </ExpandCollapseColumn>

<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
        </mastertableview>
      </telerik:RadGrid>
      <br />
      <br />
    </td>
  </tr>
</table>

  public partial class DaySaveResources_New : Base.BSPProduct
  {
    private DataSet UserResourcesDataSet
    {
      get
      {
        if (Session[DataSetNames.UserDataSet.ToString()] == null)
        {
          var dataset = CustomerDataSet(); //UserDataSet(true);
          try
          {
            //DaySaveManager.PopulateDaySavePlanDataSet(dataset, UserGroupID);
            Session[DataSetNames.UserDataSet.ToString()] = dataset;
          }
          catch (Exception)
          {
            Session[DataSetNames.UserDataSet.ToString()] = null;
          }
        }

        return (DataSet)Session[DataSetNames.UserDataSet.ToString()];
      }
    }

    private long UserGroupID
    {
      get
      {
        //return DaySave.UserGroupID;
        return 356450;
      }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {
        //Setting Selected index prior to binding RadGrid:
        //If the index is in detail table, parent items will be expanded
        //automatically
        RadGrid_New.SelectedIndexes.Add(0, 0, 1, 0, 0);
        //Index of 1, 0, 1, 0, 0 means:
        //1 - item with index 1 in the MasterTabelView
        //0 - detail table with index 0
        //1 - item with index 1 (the second item) in the first detail table
        //0 - 0 the third-level detail table
        //0 - the item with index 0 in the third-level table
      }
    }

    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
      try
      {
        RadGrid_New.DataSource = UserResourcesDataSet;
      }
      catch (Exception ex)
      {
        HandleException(ex);
      }
    }

    protected void RadGrid1_DetailTableDataBind(object sender, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
    {

    }

    /// <summary>
    /// return dataset schema
    /// </summary>
    /// <param name="addTestData"></param>
    /// <returns></returns>
    public static DataSet UserDataSet(Boolean addTestData)
    {
      DataSet dataset = new DataSet();

      ////////////////////////////////////////Users Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      DataTable dataTable = new DataTable();
      dataTable.TableName = TableNames.Users.ToString();
      dataTable.Columns.Add(ColumnNames.UserID.ToString());
      dataTable.Columns.Add(ColumnNames.FirstName.ToString());
      dataTable.Columns.Add(ColumnNames.LastName.ToString());
      dataTable.Columns.Add(ColumnNames.Email.ToString());
      dataTable.Columns.Add(ColumnNames.Password.ToString());
      DataColumn[] keys = new DataColumn[1];
      keys[0] = dataTable.Columns[ColumnNames.UserID.ToString()];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);
      //Test Data
      if (addTestData)
      {
        dataTable.Rows.Add(new object[] { 1, "USER 1", "PATEL 1", "user1@gen-i.co.nz", "********" });
        dataTable.Rows.Add(new object[] { 2, "USER 2", "PATEL 2", "user2@gen-i.co.nz", "********" });
        dataTable.Rows.Add(new object[] { 3, "USER 3", "PATEL 3", "user3@gen-i.co.nz", "********" });
        dataTable.Rows.Add(new object[] { 4, "USER 4", "PATEL 4", "user4@gen-i.co.nz", "********" });
        dataTable.Rows.Add(new object[] { 5, "USER 5", "PATEL 5", "user5@gen-i.co.nz", "********" });
      }
      ////////////////////////////////////////Licenses Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable();
      dataTable.TableName = TableNames.Licenses.ToString();
      dataTable.Columns.Add(ColumnNames.UserID.ToString());
      dataTable.Columns.Add(ColumnNames.Type.ToString());
      dataTable.Columns.Add(ColumnNames.LicenseKey.ToString());
      dataTable.Columns.Add(ColumnNames.Storage.ToString());
      dataTable.Columns.Add(ColumnNames.UsedStorage.ToString());
      dataTable.Columns.Add(ColumnNames.MachineID.ToString());
      keys = new DataColumn[1];
      keys[0] = dataTable.Columns[ColumnNames.LicenseKey.ToString()];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);
      //Test Data
      if (addTestData)
      {
        dataTable.Rows.Add(new object[] { 1, "PC", Guid.NewGuid().ToString(), "40", "50" });
        dataTable.Rows.Add(new object[] { 2, "PC", Guid.NewGuid().ToString(), "25", "50" });
        dataTable.Rows.Add(new object[] { 1, "Server", Guid.NewGuid().ToString(), "20", "50" });
        dataTable.Rows.Add(new object[] { 4, "Server", Guid.NewGuid().ToString(), "30", "50" });
        dataTable.Rows.Add(new object[] { 5, "PC", Guid.NewGuid().ToString(), "12", "50" });
      }

      ////////////////////////////////////////Unallocated Licenses Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable();
      dataTable.TableName = TableNames.ServerLicensesUnallocated.ToString();
      dataTable.Columns.Add(ColumnNames.Type.ToString());
      dataTable.Columns.Add(ColumnNames.LicenseKey.ToString());
      keys = new DataColumn[1];
      keys[0] = dataTable.Columns[ColumnNames.LicenseKey.ToString()];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);

      dataTable = new DataTable();
      dataTable.TableName = TableNames.PCLicensesUnallocated.ToString();
      dataTable.Columns.Add(ColumnNames.Type.ToString());
      dataTable.Columns.Add(ColumnNames.LicenseKey.ToString());
      keys = new DataColumn[1];
      keys[0] = dataTable.Columns[ColumnNames.LicenseKey.ToString()];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);

      ////////////////////////////////////////Aggregation Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable();
      dataTable.TableName = TableNames.ServerAggregation.ToString();
      dataTable.Columns.Add(ColumnNames.TotalStorage.ToString());
      dataTable.Columns.Add(ColumnNames.TotalLicenses.ToString());
      dataTable.Columns.Add(ColumnNames.UnallocatedStorage.ToString());
      dataTable.Columns.Add(ColumnNames.UnallocatedLicenses.ToString());
      dataset.Tables.Add(dataTable);

      dataTable = new DataTable();
      dataTable.TableName = TableNames.PCAggregation.ToString();
      dataTable.Columns.Add(ColumnNames.TotalStorage.ToString());
      dataTable.Columns.Add(ColumnNames.TotalLicenses.ToString());
      dataTable.Columns.Add(ColumnNames.UnallocatedStorage.ToString());
      dataTable.Columns.Add(ColumnNames.UnallocatedLicenses.ToString());
      dataset.Tables.Add(dataTable);

      DataRelation UserLicensesRelation = new DataRelation(RelationNames.UserLicenses.ToString(),
       dataset.Tables[TableNames.Users.ToString()].Columns[ColumnNames.UserID.ToString()],
       dataset.Tables[TableNames.Licenses.ToString()].Columns[ColumnNames.UserID.ToString()]);

      dataset.Relations.Add(UserLicensesRelation);
      //DaySaveManager.PopulateDaySavePlanDataSet(dataset, 311742, 100, 100);
      return dataset;
    }

    private DataSet CustomerDataSet()
    {
      DataSet dataset = new DataSet();

      ////////////////////////////////////////Customers Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      DataTable dataTable = new DataTable();
      dataTable.TableName = "Customers";
      dataTable.Columns.Add("CustomerID");
      dataTable.Columns.Add("Country");
      dataTable.Columns.Add("City");
      dataTable.Columns.Add("CompanyName");
      dataTable.Columns.Add("ContactName");
      dataTable.Columns.Add("TotalOrders", typeof(Double));
      dataTable.Columns.Add("TotalAmount", typeof(Double));
      DataColumn[] keys = new DataColumn[1];
      keys[0] = dataTable.Columns["CustomerID"];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);

      dataTable.Rows.Add(new object[] { "SEVES", "UK", "London", "Seven Seas Imports", "Hari Kumar", 26, 17170.1501083374 });
      dataTable.Rows.Add(new object[] { "OLDWO", "USA", "Anchorage", "Old World Delicatessen", "Rene Phillips", 24, 16323.5498657227 });
      dataTable.Rows.Add(new object[] { "FRANS", "Italy", "Torino", "Franchi S.p.A.", "Paolo Accorti", 10, 1545.69999885559 });
      dataTable.Rows.Add(new object[] { "MAGAA", "Italy", "Bergamo", "Magazzini Alimentari Riuniti", "Giovanni Rovelli", 21, 7602.79999160767 });
      dataTable.Rows.Add(new object[] { "SIMOB", "Denmark", "Kobenhavn", "Simons bistro", "Jytte Petersen", 15, 18136.3499946594 });
      dataTable.Rows.Add(new object[] { "LAZYK", "USA", "Walla Walla", "Lazy K Kountry Store", "John Steel", 2, 357 });
      dataTable.Rows.Add(new object[] { "CHOPS", "Switzerland", "Bern", "Chop-suey Chinese", "Yang Wang", 22, 12884.999961853 });
      dataTable.Rows.Add(new object[] { "ERNSH", "Austria", "Graz", "Ernst Handel", "Roland Mendel", 102, 113229.730472565 });
      dataTable.Rows.Add(new object[] { "FRANK", "Germany", "M�nchen", "Frankenversand", "Peter Franken", 48, 28719.5600280762 });
      dataTable.Rows.Add(new object[] { "HILAA", "Venezuela", "San Crist�bal", "HILARION-Abastos", "Carlos Hern�ndez", 45, 23610.0800743103 });
      dataTable.Rows.Add(new object[] { "CENTC", "Mexico", "M�xico D.F.", "Centro comercial Moctezuma", "Francisco Chang", 2, 100.799999237061 });
      dataTable.Rows.Add(new object[] { "GOURL", "Brazil", "Campinas", "Gourmet Lanchonetes", "Andr� Fonseca", 19, 8700.92997741699 });
      dataTable.Rows.Add(new object[] { "BLONP", "France", "Strasbourg", "Blondel p�re et fils", "Fr�d�rique Citeaux", 26, 19087.2500305176 });
      dataTable.Rows.Add(new object[] { "THEBI", "USA", "Portland", "The Big Cheese", "Liz Nixon", 7, 3361 });

      ////////////////////////////////////////Orders Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable();
      dataTable.TableName = "Orders";
      dataTable.Columns.Add("OrderID");
      dataTable.Columns.Add("CustomerID");
      dataTable.Columns.Add("ShipName");
      dataTable.Columns.Add("ShipCity");
      dataTable.Columns.Add("ShipCountry");
      dataTable.Columns.Add("EmployeeID");
      keys = new DataColumn[2];
      keys[0] = dataTable.Columns["OrderID"];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);

      dataTable.Rows.Add(new object[] { 1, "SEVES", "Richter Supermarkt", "Sofia", "Bulgaria", 1 });
      dataTable.Rows.Add(new object[] { 2, "SEVES", "Wellington Importadora", "Bern", "Germany", 2 });
      dataTable.Rows.Add(new object[] { 3, "OLDWO", "Que Del�cia", "Paris", "France", 3 });
      dataTable.Rows.Add(new object[] { 4, "FRANK", "Tortuga Restaurante", "M�nchen", "Germany", 4 });
      dataTable.Rows.Add(new object[] { 5, "OLDWO", "Romero y tomillo", "Lisabon", "Portugal", 5 });
      dataTable.Rows.Add(new object[] { 6, "LAZYK", "Ricardo Adocicados", "Copenhagen", "Denmark", 6 });
      dataTable.Rows.Add(new object[] { 7, "BLONP", "Reggiani Caseifici", "Moscow", "Russia", 7 });
      dataTable.Rows.Add(new object[] { 8, "ERNSH", "Que Del�cia", "San Crist�bal", "Venezuela", 8 });
      dataTable.Rows.Add(new object[] { 9, "ERNSH", "Die Wandernde Kuh", "Graz", "Austria", 9 });
      dataTable.Rows.Add(new object[] { 10, "Frans", "Die Wandernde Kuh", "Viena", "Austria", 10 });


      ////////////////////////////////////////Employees Table//////////////////////////////////////////////////////////////////
      ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable("Employees");
      dataTable.Columns.Add("EmployeeID");
      dataTable.Columns.Add("LastName");
      dataTable.Columns.Add("FirstName");
      dataTable.Columns.Add("Title");
      dataTable.Columns.Add("BirthDate");
      dataTable.Columns.Add("Country");
      keys = new DataColumn[1];
      keys[0] = dataTable.Columns["EmployeeID"];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);

      dataTable.Rows.Add(new object[] { 1, "Avilon", "Nancy", "Sales Representative", "12/8/1948 12:00:00 AM", "USA" });
      dataTable.Rows.Add(new object[] { 2, "Leverling", "Janet", "Sales Representative", "12/5/1968 12:00:00 AM", "USA" });
      dataTable.Rows.Add(new object[] { 3, "Peacock", "Margaret", "Sales Representative", "2/8/1988 12:00:00 AM", "USA" });
      dataTable.Rows.Add(new object[] { 4, "Buchanan", "Steven", "President", "1/8/1953 12:00:00 AM", "USA" });
      dataTable.Rows.Add(new object[] { 5, "Suyama", "Michael", "Vice President", "12/8/1956 12:00:00 AM", "UK" });
      dataTable.Rows.Add(new object[] { 6, "King", "Robert", "Sales Representative", "3/9/1978 12:00:00 AM", "UK" });
      dataTable.Rows.Add(new object[] { 7, "Callahan", "Laura", "Sales Representative", "9/1/1980 12:00:00 AM", "UK" });
      dataTable.Rows.Add(new object[] { 8, "Dodsworth", "Anne", "Sales Representative", "3/18/1968 12:00:00 AM", "Spain" });
      dataTable.Rows.Add(new object[] { 9, "Fuller", "Andrew", "Sales Representative", "4/8/1981 12:00:00 AM", "Austria" });
      dataTable.Rows.Add(new object[] { 10, "Smith", "John", "President", "6/9/1980 12:00:00 AM", "Bulgaria" });

      ////////////////////////////////////////OrderDetails Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable("OrderDetails");
      dataTable.Columns.Add("OrderID");
      dataTable.Columns.Add("ProductID");
      dataTable.Columns.Add("Quantity");
      dataTable.Columns.Add("UnitPrice");
      keys = new DataColumn[2];
      keys[0] = dataTable.Columns["OrderID"];
      keys[1] = dataTable.Columns["ProductID"];
      dataTable.PrimaryKey = keys;
      dataset.Tables.Add(dataTable);


      dataTable.Rows.Add(new object[] { 1, 2, 15, 7 });
      dataTable.Rows.Add(new object[] { 2, 1, 50, 7 });
      dataTable.Rows.Add(new object[] { 3, 3, 60, 23 });
      dataTable.Rows.Add(new object[] { 3, 5, 80, 4 });
      dataTable.Rows.Add(new object[] { 5, 6, 10, 31 });
      dataTable.Rows.Add(new object[] { 7, 7, 10, 25 });
      dataTable.Rows.Add(new object[] { 8, 8, 10, 15 });
      dataTable.Rows.Add(new object[] { 9, 9, 8, 12 });
      dataTable.Rows.Add(new object[] { 10, 4, 8, 12 });

      ////////////////////////////////////////Products Table//////////////////////////////////////////////////////////////////
      //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
      dataTable = new DataTable("Products");
      dataTable.Columns.Add("ProductID");
      dataTable.Columns.Add("ProductName");
      dataTable.Columns.Add("QuantityPerUnit");
      dataTable.Columns.Add("UnitsOnStock");
      keys = new DataColumn[1];
      keys[0] = dataTable.Columns["ProductID"];
      dataTable.PrimaryKey = keys;

      dataset.Tables.Add(dataTable);

      dataTable.Rows.Add(new object[] { 1, "Chai", "10 boxes x 20 bags", 45 });
      dataTable.Rows.Add(new object[] { 2, "Chang", "24 - 12 oz bottles", 34 });
      dataTable.Rows.Add(new object[] { 3, "Aniseed Syrup", "12 - 550 ml bottles", 61 });
      dataTable.Rows.Add(new object[] { 4, "Cheese cake", "12 packages", 36 });
      dataTable.Rows.Add(new object[] { 5, "Chef Anton's Cajun Seasoning", "48 - 6 oz jars", 80 });
      dataTable.Rows.Add(new object[] { 6, "Chef Anton's Gumbo Mix", "36 boxes", 78 });
      dataTable.Rows.Add(new object[] { 7, "Grandma's Boysenberry Spread", "12 - 8 oz jars", 91 });
      dataTable.Rows.Add(new object[] { 8, "Northwoods Cranberry Sauce", "12 - 12 oz jars", 123 });
      dataTable.Rows.Add(new object[] { 9, "Mishi Kobe Niku", "18 - 500 g pkgs.", 54 });

      DataRelation CustomersOrdersRelation = new DataRelation("CustomersOrders", dataset.Tables["Customers"].Columns["CustomerID"], dataset.Tables["Orders"].Columns["CustomerID"]);
      DataRelation OrdersEmployees = new DataRelation("OrdersEmployees", dataset.Tables["Orders"].Columns["EmployeeID"], dataset.Tables["Employees"].Columns["EmployeeID"]);
      DataRelation OrdersOrderDetails = new DataRelation("OrdersOrderDetails", dataset.Tables["Orders"].Columns["OrderID"], dataset.Tables["OrderDetails"].Columns["OrderID"]);
      DataRelation OrderDetailsProducts = new DataRelation("OrderDetailsProducts", dataset.Tables["OrderDetails"].Columns["ProductID"], dataset.Tables["Products"].Columns["ProductID"]);

      dataset.Relations.Add(CustomersOrdersRelation);
      dataset.Relations.Add(OrdersEmployees);
      dataset.Relations.Add(OrdersOrderDetails);
      dataset.Relations.Add(OrderDetailsProducts);

      return dataset;
    }
    private void DisplayMessage(string text)
    {
      RadGrid_New.Controls.Add(new LiteralControl(string.Format("<span style='color:red'>{0}</span>", text)));
    }
  }
0
Daniel
Telerik team
answered on 13 Sep 2010, 09:19 AM
Hello Parimal,

Thank you for the sample code. I successfully reproduced the described behavior on my end and I notified our developers about this problem. I will let you know when I have more information about the status of this issue.
As a sign of gratitude for your cooperation I updated your Telerik points.

Best regards,
Daniel
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Telerik team
answered on 14 Sep 2010, 09:48 PM
Hello Parimal,

I examined the code again and I noticed that you are using the AutoGeneratedHierarchy functionality. Unfortunately it is not possible to enable the CommandItem for the detail tables in this scenario. Please use the standard (non-autogenerated) hierarchy instead:
Hierarchical data-binding using DetailTableDataBind event
Hierarchical data-binding using declarative relations

Please excuse us for the inconvenience

Regards,
Daniel
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Neto
Top achievements
Rank 1
answered on 23 Jul 2012, 06:19 PM
I have the same problem
and im searching a solution and i notice one thing

a lot of people like me are trying to change this sample
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx  (Update/Insert/Delete  in hierarchy)
but with a different Data source, like DataSets in Offline mode , like this sample
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/autogeneratedhierarchy/defaultcs.aspx 


I think would be great if telerik provide  the (Update/Insert/Delete  in hierarchy)  but using the DataSets

thank you 




0
Daniel
Telerik team
answered on 26 Jul 2012, 10:34 AM
Hello Neto,

You could use advanced data-binding (using NeedDataSource and DetailTableDataBind events) for this scenario. For more information, please examine the following links:

Demo:
Programmatic Binding

Documentation:
Hierarchical data-binding using DetailTableDataBind event

Best regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Oscar
Top achievements
Rank 1
answered on 29 Jan 2013, 01:08 PM
Any update on this issue? I'm still experiencing this and was unable to find a more recent post on this subject.

I have 3 levels (MasterTableView > DetailTables > DetailTables). On the MasterTableView and last DetailTables the Add New Record is visible but not on the first DetailTables.
0
Daniel
Telerik team
answered on 01 Feb 2013, 02:48 PM
Hello Oscar,

Are you using the autogenerated hierarchy feature? If not, could you please post your markup here?

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Oscar
Top achievements
Rank 1
answered on 01 Feb 2013, 03:51 PM
Hello Daniel,

Thank you for your response. This is the RadGrid snippet:

<telerik:RadGrid ID="trgMedicine" runat="server" OnNeedDataSource="trgMedicineNeedDataSource" AllowSorting="true" OnItemDataBound="trgMedicineItemDataBound"
    AutoGenerateHierarchy="true" AutoGenerateColumns="false" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true"
    OnDeleteCommand="trgMedicineDeleteCommand" OnInsertCommand="trgMedicineInsertCommand" OnUpdateCommand="trgMedicineUpdateCommand"
    OnItemCommand="trgMedicineItemCommand" OnPreRender="trgMedicinePreRender" Culture="nl-NL">
    <GroupingSettings CaseSensitive="false" />
    <%-- Medicines master table view --%>
    <MasterTableView DataKeyNames="Medicine_ID" NoMasterRecordsText="(geen resultaten)" NoDetailRecordsText="(geen resultaten)"
        Caption="Geneesmiddelen" CommandItemDisplay="Top" EditMode="PopUp" Name="Medicines">
        <CommandItemSettings AddNewRecordText="Nieuw geneesmiddel toevoegen" />
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumnMedicine">
                <ItemStyle CssClass="MyImageButton"></ItemStyle>
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn DataField="Substance_Name_Number" UniqueName="test"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Brand"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Contact"></telerik:GridBoundColumn>
            <telerik:GridButtonColumn ConfirmText="<p>Dit geneesmiddel wordt verwijderd.</p><p>Weet u dit zeker?</p>" ConfirmDialogType="RadWindow"
                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                UniqueName="DeleteColumnMedicine">
                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
            </telerik:GridButtonColumn>
        </Columns>
        <EditFormSettings ColumnNumber="1" CaptionDataField="Substance_Name_Number" CaptionFormatString="Eigenschappen van geneesmiddel {0}"
            InsertCaption="Geneesmiddel toevoegen" EditFormType="Template">
            <FormTemplate>
                <nvd:MedicineFieldControl ID="mfcMedicine" runat="server"></nvd:MedicineFieldControl>
            </FormTemplate>
        </EditFormSettings>
        <DetailTables>
 
            <%-- Indications detail table view --%>
            <telerik:GridTableView DataKeyNames="Indication_ID" Name="Indications"
                NoMasterRecordsText="(geen resultaten)" NoDetailRecordsText="(geen resultaten)" Caption="Indicaties"
                CommandItemDisplay="Top" EditMode="PopUp">
                <CommandItemSettings AddNewRecordText="Nieuwe indicatie toevoegen" />
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumnIndication">
                        <ItemStyle CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="Indication_SPC"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Main_Indication_Description"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Registration_Date"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ConfirmText="<p>Deze indicatie wordt verwijderd.</p><p>Weet u dit zeker?</p>" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumnIndication">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings ColumnNumber="1" CaptionDataField="Indication_SPC" CaptionFormatString="Eigenschappen van indicatie {0}"
                    InsertCaption="Indicatie toevoegen" EditFormType="Template">
                    <FormTemplate>
                        <nvd:IndicationFieldControl ID="ifcIndication" runat="server"></nvd:IndicationFieldControl>
                    </FormTemplate>
                </EditFormSettings>
                <DetailTables>
 
                    <%-- Reimbursement requests table view --%>
                    <telerik:GridTableView DataKeyNames="Reimbursement_Request_ID" Name="ReimbursementRequests"
                        NoMasterRecordsText="(geen resultaten)" NoDetailRecordsText="(geen resultaten)" Caption="Aanvragen"
                        CommandItemDisplay="Top" EditMode="PopUp">
                        <CommandItemSettings AddNewRecordText="Nieuwe aanvraag toevoegen" />
                        <Columns>
                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumnReimbursementRequest">
                                <ItemStyle CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridEditCommandColumn>
                            <telerik:GridBoundColumn HeaderText="Aanvraagtype" DataField="Request_Type_Description"></telerik:GridBoundColumn>
                            <telerik:GridButtonColumn ConfirmText="<p>Deze aanvraag wordt verwijderd.</p><p>Weet u dit zeker?</p>" ConfirmDialogType="RadWindow"
                                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                                UniqueName="DeleteColumnReimbursementRequest">
                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton"></ItemStyle>
                            </telerik:GridButtonColumn>
                        </Columns>
                        <EditFormSettings ColumnNumber="1" CaptionDataField="Reimbursement_Request_ID" CaptionFormatString="Eigenschappen van aanvraag ID {0}"
                            InsertCaption="Aanvraag toevoegen" EditFormType="Template">
                            <FormTemplate>
                                <table id="EditReimbursementRequestTable" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                                    style="border-collapse: collapse; background: white;">
                                    <tr>
                                        <td>
                                            Aanvraagtype:
                                        </td>
                                        <td>
                                            <telerik:RadComboBox ID="rcbRequestTypeID" runat="server" DataValueField="RequestTypeID" DataTextField="Description" AppendDataBoundItems="true">
                                                <Items>
                                                    <telerik:RadComboBoxItem Value="0" Text="" />
                                                </Items>
                                            </telerik:RadComboBox>
                                            <asp:RequiredFieldValidator ID="rfvRequestTypeID" ControlToValidate="rcbRequestTypeID"
                                                ErrorMessage="Dit veld is verplicht" runat="server" Display="Dynamic"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Opmerking:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtRemark" runat="server" TextMode="MultiLine" Rows="3" Text='<%# Bind("Remark") %>'></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right" colspan="2">
                                            <asp:Button ID="btnInsertUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Toevoegen" : "Opslaan" %>'
                                                runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button>
                                            <asp:Button ID="btnCancel" Text="Annuleren" runat="server" CausesValidation="False" CommandName="Cancel"></asp:Button>
                                        </td>
                                    </tr>
                                </table>
                            </FormTemplate>
                        </EditFormSettings>
                    </telerik:GridTableView>
 
                </DetailTables>
            </telerik:GridTableView>
 
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>

Regards,
Oscar
0
Daniel
Telerik team
answered on 06 Feb 2013, 04:38 PM
Hello Oscar,

Thanks for the code. I'm afraid this feature is not supported by the autogenerated hierarchy.
Please accept our apologies for any inconvenience caused.

All the best,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Karl Wilkens
Top achievements
Rank 1
Sebastian
Telerik team
Parimal
Top achievements
Rank 1
Daniel
Telerik team
Neto
Top achievements
Rank 1
Oscar
Top achievements
Rank 1
Share this question
or