ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Hiding root element of Google Organizational Chart in ASP.Net<p>Hi dharmendr,</p> <p>I got one new but tricky solution.&nbsp;I am following this steps:</p> <p>1) create temporary table with an extra field-temp.</p> <p>2) insert values from Employee table in it. Insert actual Repto_ID in temp column.</p> <p>3) Update&nbsp;ReportingManager = NULL where Temp = NULL</p> <p>4) Select Query.&nbsp;</p> <p>It works fine. Thanks a lot for your help :)</p> <p>Following is the query:&nbsp;</p> <pre class="brush: sql">CREATE TABLE [dbo].[EmployeesHierarchy]( [EmployeeId] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](100) NULL, [Designation] [varchar](30) NULL, [ReportingManager] [int] NULL ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO SET IDENTITY_INSERT [dbo].[EmployeesHierarchy] ON INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (1, N&#39;Nancy Davolio&#39;, N&#39;Sales Representative&#39;, 5) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (2, N&#39;Andrew Fuller&#39;, N&#39;CEO&#39;, 3) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (3, N&#39;Janet Leverling&#39;, N&#39;MD&#39;, NULL) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (4, N&#39;Margaret Peacock&#39;, N&#39;Sales Representative&#39;, 5) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (5, N&#39;Steven Buchanan&#39;, N&#39;Sales Manager&#39;, 2) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (6, N&#39;Michael Suyama&#39;, N&#39;Sales Representative&#39;, 8) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (7, N&#39;Robert King&#39;, N&#39;Sales Representative&#39;, 8) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (8, N&#39;Laura Callahan&#39;, N&#39;Sales Manager&#39;, 2) INSERT [dbo].[EmployeesHierarchy] ([EmployeeId], [Name], [Designation], [ReportingManager]) VALUES (9, N&#39;Anne Dodsworth&#39;, N&#39;Sales Representative&#39;, 5) SET IDENTITY_INSERT [dbo].[EmployeesHierarchy] OFF DECLARE @EmployeesHierarchy AS TABLE(EmployeeId INT,Name VARCHAR(20),Designation VARCHAR(20),ReportingManager INT,Temp VARCHAR(50)) INSERT INTO @EmployeesHierarchy SELECT E1.EmployeeId,E1.Name,E1.Designation,E1.ReportingManager,E2.ReportingManager FROM EmployeesHierarchy E1 LEFT OUTER JOIN EmployeesHierarchy E2 ON E1.ReportingManager = E2.EmployeeId WHERE ISNULL(E2.Name,&#39;&#39;) &gt; &#39;&#39; UPDATE @EmployeesHierarchy SET ReportingManager = NULL WHERE ReportingManager NOT IN (SELECT EmployeeId FROM @EmployeesHierarchy) SELECT * FROM @EmployeesHierarchy</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/178182/Hiding-root-element-of-Google-Organizational-Chart-in-ASPNet/http://www.aspforums.net/Threads/178182/Hiding-root-element-of-Google-Organizational-Chart-in-ASPNet/Tue, 20 Sep 2016 00:05:18 GMT