Nested Gridviews

C

Chris

I am creating a nested gridview as per the tutorial here
(http://msdn2.microsoft.com/en-us/library/aa992038(vs.80).aspx). My
gridviews work fine. I have a master gridview containing the customerid.
This value is used by a a detail gridview nested within the master. This
works well but when I hide the customerid the filter stops working. I
suspect that this code can't find the ID to do the filtering. How do get
around this as I want to hide the CustomerID. Also how efficient is this?
Does it involve a separate call to the database for each row in the parent.
Is it possible grab all the child detail data in one go and filter via a
dataview. I quite like using typed datasets and the objectdatasource but I
don't want ineffiicient code. Regards, Chris.

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound

If e.Row.RowType = DataControlRowType.DataRow Then

Dim o As ObjectDataSource = CType(e.Row.FindControl("objdsgetorders"),
ObjectDataSource)

o.SelectParameters(0).DefaultValue = e.Row.Cells(0).Text

End If

End Sub
 
C

Chris

I found another way but if anyone has any opinions on the other questions
they would be welcome.

o.SelectParameters(0).DefaultValue =
GridView1.DataKeys(e.Row.DataItemIndex).Value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top