Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Nested Gridviews

Reply
Thread Tools

Nested Gridviews

 
 
Chris
Guest
Posts: n/a
 
      04-01-2007
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




 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      04-01-2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple nested gridviews JohnE ASP .Net 0 03-23-2010 07:45 AM
Gridviews and Nested Gridview katmagic ASP .Net 0 01-17-2009 11:56 PM
Nested GridViews In UserControls. Mr Nobody ASP .Net 2 07-25-2008 04:38 PM
"codeless" nested gridviews...there has to be a better way Roy ASP .Net 1 06-16-2006 05:35 PM
Nested GridViews plus DetailsView manuel.ricca@gmail.com ASP .Net 0 04-27-2006 05:00 PM



Advertisments