vb.net:Show symbol "+" in each row of datagrid if got children

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simonyong
    New Member
    • Jul 2008
    • 28

    vb.net:Show symbol "+" in each row of datagrid if got children

    hello, everyone
    Sorry for disturb..
    im newbie to asp.net
    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,Firstnam e,Lastname...an d 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(invis ible)

    at dataGrid1_itemD ataBound, i databind each row personnel_numbe r 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.DataS ource = GetChildrenData Set(directNo)
    DataGrid2.DataB ind()
    If DataGrid3.Items .Count = 0 Then
    dgitem.Cells(6) .Text = ""
    End If

    Next

    Is the method i use correct?
    Thanks for teaching me...
    Last edited by simonyong; Aug 1 '08, 07:11 AM. Reason: edit title
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I don't know if this can help you but there is a TreeView Control available for ASP.NET developers....l ook into it....
    -Frinny

    Comment

    Working...