I am new to asp.net though not to asp. I want to display two gridboxes, the first with master records and the second with child records linked to the master table id. The idea is to change the child records when the parent record is selected, or ideally, when the page index is changed. Is there any way to do this without a complicated song and dance? I am not using MS SQL Server, but MySQL, so it is not possible to specify a parameter in the Data Source configuration dialog.

I solved my own problem, like this in case it will help another beginner:

Protected Sub ParentGridView_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles ParentGridView.PageIndexChanging
ParentGridView.PageIndex = e.NewPageIndex
ParentGridView.DataBind()
Childdatasource.SelectCommand = "Select * From child where id_parent="+ ParentGridView.Rows(0).Cells (1).Text
End Sub

where

ParentGridView.Rows(0).Cells (1).Text is the index field of the parent grid

P.S.
Childdatasource.SelectCommand = "Select * From child where id_parent="+ ParentGridView.Rows(0).Cells (1).Text
has to be placed in the page load event as well for initial functionality...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.