By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,121 Members | 648 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,121 IT Pros & Developers. It's quick & easy. symbol "+" in each row of datagrid if got children

P: 28
hello, everyone
Sorry for disturb..
im newbie to
im trying to do a task that as below:

In a SAME datagrid, it ll show all data when user key in key word in textbox...
datagrid will show out Personnel number,Firstname,Lastname...and last is direct manager personnel number
i create a column in datagrid, and put symbol '+'..
if the datagrid item of each row have children, then show '+',to expand it...
how parent and children related?
ok, let me define here:
each employee hav a personnel number and direct manager personnel number
each employee hav a person direct to
for example, IT manager hav a personnel number --10,and direct manager personnel number -1
it mean that all employee in IT department will hav 10 as their direct manager personnel number b/cos they report to IT manager
and the IT manager report to CEO who hav 1 as his personnel number

I want my datagrid to show "+" in each datagrid item in each row if there are employee report to the person, and show nothing if the person does not have employee report to him..

i successful to display what i wan
but it take LONG TIME to complete it
i think is my coding going wrong
i hope senior in here can give me some direction:

method i use is :
i use 2 datagrid-- datagrid1 and datagrid2(invisible)

at dataGrid1_itemDataBound, i databind each row personnel_number as DirectNo into datagrid2 and get result if no row then show nothing in datagrid1
it can run but waste lots of time on it....
can anyone tell me a better way to get it?

For Each dgitem In DataGrid1.Items
directNo = dgitem.Cells(0).Text
DataGrid2.DataSource = GetChildrenDataSet(directNo)
If DataGrid3.Items.Count = 0 Then
dgitem.Cells(6).Text = ""
End If


Is the method i use correct?
Thanks for teaching me...
Aug 1 '08 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,731
I don't know if this can help you but there is a TreeView Control available for ASP.NET developers....look into it....
Aug 1 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.