Radgrid with multi detail tables

3 posts, 0 answers
  1. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 12 Sep Link to this post

    I have a radgrid with a 3-tier structure (master -> detail -> detaildetail)

    In my ItemDataBound event:

    protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
     ... code referencing e.Item
    }

    how can I determine which "tier" e.Item is?

    The <telerik:GridTableView> markup does not appear to allow me to specify a separate ItemDataBound handler for each "tier".

    Thanks,


    .

    .

    .

  2. Pierre
    Pierre avatar
    56 posts
    Member since:
    Jun 2016

    Posted 13 Sep in reply to ToltingColtAcres Link to this post

    Hi,

    There is 2 way to travel through the nested hierachy.
    Depending on your HierarchyLoadMode.

    If i need to access detail tables , items etc .
    I add a OnPreRender in the MasterTableView.

    protected void Unnamed_PreRender(object sender, EventArgs e)
    {
        MyControler(RadGRID_MASTER.MasterTableView);
    }

    .


      private void MyControler(GridTableView gridTableView)
    {
        GridItem[] nestedViewItems = gridTableView.GetItems(GridItemType.NestedView);
     
        foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
        {
     
            foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
            {
                // Here you can operate your controls the way you want.
                 
                    // nestedView.Name == "LAC" Name of the current DetailTable
                    // gridTableView.Name == "Dad"  Name of the parent Table.
                if (nestedView.Name == "LAC" && nestedView.Items.Count == 0)
                    // Do stuff
                     
                    }
     
                if(nestedView.HasDetailTables)
                    { MyControler(nestedView); }
            }
        }
    }

    I hope this will help you.
    Regards,
    Pierre

    .
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 13 Sep in reply to Pierre Link to this post

    I managed to find a solution:

     

    protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)
    {
       String sName = e.Item.OwnerTableView.Name;
    ...
       if ( e.Item is GridEditFormItem && sName == "Header" )
       {
          ...
       }
    ...
    }

Back to Top