I have a RowDataBound that loops each record and executes a query with the OrderId to get the detail data. Then, its values are bound to a nested GridView named gvOrders. The issue I'm having is that I'm only getting the results of the last OrderId value of the loop bound to the GridView gvOrders. Can anyone help me get the results of all the loops in the GridView gvOrders? There seems to be an issue with my binding method.
Protected Sub GridViewDetailInfo_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridViewDetailInfo.RowDataBound
Dim strSQL As String
If e.Row.RowType = DataControlRowType.DataRow Then
Dim OrderId As String = e.Row.Cells(1).Text
Dim gvOrders As GridView = DirectCast(e.Row.FindControl("gvOrders"), GridView)
strSQL = "select Qty, Prod, Date from Order..orders where OrderNo='" + OrderId + "'"
Me.SqlDataSourceDetail_Child.SelectCommand = strSQL
gvOrders.DataBind()
End If
End Sub