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

Hirarchy Grid

8 Answers 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raju
Top achievements
Rank 1
raju asked on 24 Oct 2008, 08:25 PM
Do we have Hierarchical Self-referencing Callback Grid in telerik. I need grid which has n-multi level which is self referencing to same table.
 
Any idea, thanks in advance for ur help.
 

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Oct 2008, 05:26 AM
Hi,

Check out the following online demo to get more details about self- referencing hierarchy in RadGrid..
Self-referencing hierarchy

Shinu.
0
Arni
Top achievements
Rank 1
answered on 05 Dec 2008, 04:57 AM
hey I need Help to bing the gridviewtables(child tables in Hierarchy) in 3 tire architecture

<telerik:RadGrid id="RGTask" runat="server" Width="100%" Skin="Web20" AutoGenerateColumns="False" AllowFilteringByColumn="True" AllowSorting="True" GridLines="None" ShowGroupPanel="True" PageSize="50"  > 
<ClientSettings> 
   <Selecting AllowRowSelect="True"/>  
   <ClientEvents OnRowSelecting="RowSelecting" /> 
 </ClientSettings> 
<MasterTableView AllowMultiColumnSorting="True" DataKeyNames="TaskID"   TableLayout="Fixed">  
  <DetailTables> 
    <telerik:GridTableView   Name="AttachTable" DataKeyNames="AttachID" runat="server> 
   <ParentTableRelation > 
       <telerik:GridRelationFields  DetailKeyField="TaskID"  MasterKeyField="TaskID"/></ParentTableRelation> 
           <Columns> 
<telerik:GridBoundColumn DataField="AttachID" EmptyDataText=" " UniqueName="AttachID" HeaderText="AttachID"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn DataField="TypeCategory" EmptyDataText=" " UniqueName="TypeCategory" HeaderText="TypeCategory"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn DataField="ActualFileName" EmptyDataText=" " UniqueName="ActualFileName" HeaderText="ActualFileName"></telerik:GridBoundColumn> 
<telerik:GridTemplateColumn  HeaderText="ViewUploads"  DataField="ActualFileName" UniqueName="TemplateColumn1">  
<ItemTemplate> 
<target="_blank"  href='<%# "Abi/"  + Eval("ActualFileName")%>'> ViewFile  
</a> 
</ItemTemplate></telerik:GridTemplateColumn>   
<telerik:GridTemplateColumn DataField="AttachID" UniqueName="TemplateColumn" HeaderText="Edit Details"><ItemTemplate> 
            <href="#" onclick="openRadWindow1('<%#DataBinder.Eval(Container.DataItem,"AttachID")%>'); return false;">Details</a> 
</ItemTemplate> 
<EditItemTemplate> 
        <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("AttachID") %>'></asp:LinkButton> 
      
</EditItemTemplate> 
</telerik:GridTemplateColumn> 
 
</Columns> 
</telerik:GridTableView> 
    </DetailTables> 
  <Columns> 
<telerik:GridBoundColumn DataField="TaskID" EmptyDataText="&#160;" UniqueName="TaskID" HeaderText="Tasks Name"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn DataField="TaskName" EmptyDataText="&#160;" UniqueName="TaskName" HeaderText="TaskName"></telerik:GridBoundColumn> 
<telerik:GridBoundColumn DataField="ActStartDate" EmptyDataText="&#160;" UniqueName="ActStartDate" HeaderText="ActStartDate"></telerik:GridBoundColumn> 
 
<telerik:GridBoundColumn DataField="ActEndDate" EmptyDataText="&#160;" UniqueName="ActEndDate" HeaderText="ActEndDate"></telerik:GridBoundColumn> 
 
<telerik:GridTemplateColumn DataField="AttachID" UniqueName="TemplateColumn" HeaderText="Edit Details"><ItemTemplate> 
            <href="#" onclick="openRadWindow('<%#DataBinder.Eval(Container.DataItem,"TaskID")%>'); return false;">  
            Details</a> 
</ItemTemplate> 
<EditItemTemplate> 
        <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("TaskID") %>'></asp:LinkButton> 
     
</EditItemTemplate> 
</telerik:GridTemplateColumn> 
 
 
</Columns> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
</MasterTableView> 
 
<FilterMenu EnableTheming="True" Skin="Web20">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
</telerik:RadGrid> 
AttachmentsEN loattachEn = new AttachmentsEN();  
        Attachment loattachBs = new Attachment();  
        List<AttachmentsEN> Objlist2;  
       Objlist2 = loattachBs.GetByTaskID(loattachEn);  
        RGTask.DataSource = Objlist2;  
        RGTask.DataBind();  
        RGTask.MasterTableView.DataSource = objlist;  
        RGTask.MasterTableView.DataBind();  
 
 
 
 TasksEn lomodEn = new TasksEn();  
        TasksBs lomodBAl = new TasksBs();  
        List<TasksEn> objlist2;  
        objlist2 = lomodBAl.GetList(lomodEn);  
 
I wili not bind my code directly with any datasoureID.. 
regarding task i do not know how to bing with detail child table..
kimdly help me yar...
0
Yavor
Telerik team
answered on 05 Dec 2008, 06:14 AM
Hi Arni,

The following example demonstrates one possible option to achieve this task. this is another approach. These should get you started properly.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Arni
Top achievements
Rank 1
answered on 05 Dec 2008, 10:12 AM
hey raju,
I did my demo using tht link as an example..
they used simply datasource id directly for all hierarchy table..
I do not want tht.
I want to  bind datasource to  child table usig the code what i gave.. ....
PLs help me..
0
Arni
Top achievements
Rank 1
answered on 05 Dec 2008, 10:13 AM
sorry I replied not to raju..
 to the person who replieed me previously..
0
Yavor
Telerik team
answered on 08 Dec 2008, 02:11 PM
Hi Arni,

Indeed, when using the second link which I provided, you can use the NeedDataSource and DetailTableDataBind event handlers, to pass the proper datasource. Additionally, you should not call DataBind for the control directly, as this would break the hierarchical functionality.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Arni
Top achievements
Rank 1
answered on 09 Dec 2008, 08:47 AM
I folwed as per U aid But got this error

The best overloaded method match for 'System.Collections.Generic.List<HANODALE.CRM.Entities.TasksEN>.Find(System.Predicate<HANODALE.CRM.Entities.TasksEN>)' has some invalid arguments


InTaskDAL GetList Method  
public List<TasksEN> GetList(TasksEN  argEn)  
        {  
            List<TasksEN> loEnList = new List<TasksEN>();  
            string sqlCmd = "select * from Tasks";  
            Microsoft.Practices.EnterpriseLibrary.Data.Database coDb = DatabaseFactory.CreateDatabase(csConnectionStr);  
            try  
            {  
                using (DbCommand cmd = coDb.GetSqlStringCommand(sqlCmd))  
                {  
                    using (IDataReader loReader = coDb.ExecuteReader(cmd))  
                    {  
                        while (loReader.Read())  
                        {  
                            TasksEN loItem = LoadObject(loReader);  
                            AttachmentsDAL lods = new AttachmentsDAL();  
                            AttachmentsEN loattitem = new AttachmentsEN();  
                            loattitem.TaskID = loItem.TaskID;  
                            loItem.listAttachment = lods.GetByTaskID(loattitem);  
                            loEnList.Add(loItem);  
                        }  
                        loReader.Close();  
                    }  
                }  
            }  
            catch (Exception ex)  
            {  
                throw ex;  
            }  
            return loEnList;  
        } 

 

 

TasksEN loTaskEn = new TasksEN();  
 
Tasks loTaskBs = new Tasks();  
List<TasksEN> objtask;  
objtask = loTaskBs.GetList(loTaskEn);  
e.DetailTableView.DataSource = objtask.Find(delegate(TasksEN TaskEn)  
{  
return TaskEn.TaskID = Convert.ToString(e.DetailTableView.ParentItem.GetDataKeyValue("TaskID"));  
}).listAttachment;  
 
      
IN AtahmentDAL  
 
 public List<AttachmentsEN> GetByTaskID(AttachmentsEN argEn)  
        {  
            List<AttachmentsEN> loEnList = new List<AttachmentsEN>();  
            string sqlCmd = "Select * FROM Attachments WHERE TaskID = @TaskID";  
            Microsoft.Practices.EnterpriseLibrary.Data.Database coDb = DatabaseFactory.CreateDatabase(csConnectionStr);  
            try  
            {  
                using (DbCommand cmd = coDb.GetSqlStringCommand(sqlCmd))  
                {  
                    coDb.AddInParameter(cmd, "@TaskID", DbType.String, argEn.TaskID);  
                    using (IDataReader loReader = coDb.ExecuteReader(cmd))  
                    {  
                        while (loReader.Read())  
                        {  
                            AttachmentsEN loItem = LoadObject(loReader);  
                            loEnList.Add(loItem);  
                        }  
                        loReader.Close();  
                    }  
                }  
            }  
            catch (Exception ex)  
            {  
                throw ex;  
            }  
            return loEnList;  
        } 

what do to  Mr.Yovar

0
Yavor
Telerik team
answered on 12 Dec 2008, 08:08 AM
Hi Arni,

From the code and the exception, I see that the error is originating from this function:

objtask.Find(delegate(TasksEN TaskEn) 

Please, ensure that you are passing the proper arguments to the function!

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
raju
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arni
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or