Question: Gridview within Gridview issue

  • Thread starter Thread starter Cirene
  • Start date Start date
C

Cirene

This is confusing...

I have a gridview (gv1) with another gridview (gv2) inside of it.

gv1 has a bunch of house listings and within each row is a group of related
house pictures (gv2).

I'm having trouble getting gv2 to show any data.

Here's part of my code...
Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gv As GridView = e.Row.FindControl("gv2")
gv.DataBind()
End If
End Sub

QUESTION 1: Any ideas what I'm doing wrong?

gv2 datasource SELECT statement is defined as "SELECT PicName FROM
ListingPics WHERE (ListingId = @ListingId)"

I would like the @ListingId variable to be filled in BY THE CURRENT ROW in
gv1.

QUESTION 2: How can I do this???

Thanks.
 
This is confusing...

I have a gridview (gv1) with another gridview (gv2) inside of it.

gv1 has a bunch of house listings and within each row is a group of related
house pictures (gv2).

I'm having trouble getting gv2 to show any data.

Here's part of my code...
Protected Sub gv1_RowDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gv As GridView = e.Row.FindControl("gv2")
gv.DataBind()
End If
End Sub

QUESTION 1: Any ideas what I'm doing wrong?

gv2 datasource SELECT statement is defined as "SELECT PicName FROM
ListingPics WHERE (ListingId = @ListingId)"

I would like the @ListingId variable to be filled in BY THE CURRENT ROW in
gv1.

QUESTION 2: How can I do this???

Thanks.

OK, I just did the same thing, that is, to have a gridview row expand
upon a button click in the row.

I followed the example at http://www.webswapp.com/codesamples/aspnet20/nestedgridviews/default.aspx

with slight modifications. For example, I don't need the details
view, so, I took that part out. It works perfect. Please take a
closer look at that example, and you'll get it.
 
Back
Top