Question: Gridview within Gridview issue

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.
 
G

gnewsgroup

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.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top