1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Error when working with hierarchy in grid

Error when working with hierarchy in grid

2 posts, 0 answered
  1. Vitaliy Podstreshniy
    Vitaliy Podstreshniy avatar
    1 posts
    Registered:
    08 Dec 2009
    23 Jul 2010
    Link to this post
    I have create simple UserControl that uses hierarchy to show detail data. It works OK before refreshing. After refreshing grid, error is thrown when I try to expand  hierarchy. This control works without errors when I place it on test page. Error is thrown when control is placed on Sitefinity page. HierarchyLoadMode="Client"

    protected void ProductsRadGrid_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e)
        {
          GridDataItem dataItem = (GridDataItem) e.DetailTableView.ParentItem;
          switch (e.DetailTableView.Name)
          {
            case "ChannelProduct":
              {

                int productId;
                if (Int32.TryParse(dataItem.GetDataKeyValue("ProductId").ToString(), out productId))
                {
                  ProductController productController = new ProductController();
                  e.DetailTableView.DataSource = productController.GetChannelProducts(productId);
                }
                break;
              }
          }
        }

        protected void ProductsRadGrid_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
          string str = @"select top 10
              p.Product_ID ProductId,
              10 Qoh,
              'http://www.site.com/prod/HMPSCR40/1t44.jpg' ProductImageUrl,
              p.[Name] ProductName,
              p.SKU ProductSku,
              0 UnitCost
              from PRODUCTS p";
          DataTable dt = GetDataTable(str);
          ProductsRadGrid.DataSource = dt;
          dt.PrimaryKey = new[] { dt.Columns["Product_ID"] };
        }
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    23 Jul 2010
    Link to this post
    Hello Vitaliy Podstreshniy,

    Could you try to create a custom control that inherits from CompositeControl or SimpleControl and see whether the problem will persists.

    All the best,
    Ivan Dimitrov
    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
2 posts, 0 answered