469,957 Members | 2,683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,957 developers. It's quick & easy.

Nested Gridviews

I am creating a nested gridview as per the tutorial here
(http://msdn2.microsoft.com/en-us/lib...8(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


Apr 1 '07 #1
1 4095
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

"Chris" <no****@nospam.comwrote in message
news:e3**************@TK2MSFTNGP04.phx.gbl...
>I am creating a nested gridview as per the tutorial here
(http://msdn2.microsoft.com/en-us/lib...8(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


Apr 1 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by manuel.ricca | last post: by
reply views Thread by titia111 | last post: by
3 posts views Thread by ThatsIT.net.au | last post: by
reply views Thread by Fabrizio | last post: by
reply views Thread by omgdork | last post: by
reply views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.