Home All Groups Group Topic Archive Search About
Author
26 Feb 2005 9:23 PM
Sandeman
I have a table with this structure
itemID
naam
image
parentID

I want to make a datagrid that contains a hyperlinkcolumn. When i click on
the hyperlink i want the subitems to become the items in the same datagrid.
(the former items will disappear and we can call them back with the button
'Back'.

For example:

I have this table tblComponents
itemID | name    | image | parentID  |
1         |  car       |  ----  |    ------    |
2         |  wheels |  ----- |      1         |
3         | chassis  | -----  |      1         |

In the first view i want to see this
itemID | name    |
1         |  car       |

After i click on car (it's a hyperlink button) i want a view like this
itemID | name
2         |  wheels |
3         | chassis  |


Can anybody help me with this?

Author
2 Mar 2005 3:07 PM
Arthur Dent
Make a template column, stick in a linkbutton, and give it a CommandName =
"drilldown" or something else appropriate.
Bind the linkbutton's CommandArgument property to the itemID property. Then
in your codebehind, handle the grids ItemCommand event. Then do something of
the nature:

Sub ItemCommand (...) handles grd.ItemCommand
    If e.CommandName = "drilldown" Then
        Dim SQL as string = "SELECT * FROM MYTABLE WHERE parentID = " &
e.CommandArgument
        grd.DataSource = BuildDataTable(SQL) '// some fictional procedure to
build the table with the SQL
        grd.DataBind
    End If
End Sub


Show quoteHide quote
"Sandeman" <ilight***@zeelandnet.nl> wrote in message
news:%23TDt2kEHFHA.3440@TK2MSFTNGP10.phx.gbl...
>I have a table with this structure
> itemID
> naam
> image
> parentID
>
> I want to make a datagrid that contains a hyperlinkcolumn. When i click on
> the hyperlink i want the subitems to become the items in the same
> datagrid. (the former items will disappear and we can call them back with
> the button 'Back'.
>
> For example:
>
> I have this table tblComponents
> itemID | name    | image | parentID  |
> 1         |  car       |  ----  |    ------    |
> 2         |  wheels |  ----- |      1         |
> 3         | chassis  | -----  |      1         |
>
> In the first view i want to see this
> itemID | name    |
> 1         |  car       |
>
> After i click on car (it's a hyperlink button) i want a view like this
> itemID | name
> 2         |  wheels |
> 3         | chassis  |
>
>
> Can anybody help me with this?
>