GridView inside gridView

Hi all,
I have a master/child type of report: 2 table tbl_part with partID as primary key and tbl_modification with modificationID as primary key and partID as foreign key.
I was able to create my nested gidviews and it for each part in the tbl_part it shows the corresponding modifications.
I added a button in gridView2, and what I want is to run some code when the button is clicked. And for that I need to get the key for gridView2. But i couldn't figure out how to do it . Please help with suggestions, codes or url's.
Thank you.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Put your second GridView in ItemTemplate of FirstGridView

Then set gridview2 datasource in Gridview1's RowDataBound event

ki_kiAuthor Commented:
Thank you to both of you.
The problem I have is not 'creating' the nested girdViews: my 2 gridViews work fine, meaning they display the data the way I want, ie, One-to-many type relationship.
What I need, is access to gridView2's key(modificationID) from a button on girdView2. Let me know if i am not clear.
ki_kiAuthor Commented:
SystemExpert, the 1st link you provided gave me a hint:

The solution to what I was looking for is below:

Protected Sub GridView2_RowCommand(ByVal sender As Object, ByVal e As


        Dim myGrid1 As GridView
        mygrid1 = CType(sender, GridView)
myGrid1.Rows(e.CommandArgument).Cells(0).Text ............this the key I am looking for
End sub

Tank you
All Courses

From novice to tech pro — start learning today.