Binding a Gridview to a DetailsView on another page

C

Coby Herd

I'm having trouble finding out how to bind a gridview containing data to
individual details on another page. Can anybody send me the code or point
me in the right direction to get a tutorial for this?

thanx


--
Coby L. Herd
112-A S.E. 13th Ave.
Ft. Lauderdale, FL. 33301
954-467-0918
www.caterdata.com/portfolio
 
P

PJ on Development

Hi, Coby

What do you mean by "binding"?

Because when I hear "bind" I usually think about Data Binding, which
is not possible.

However, if you're refereing to displaying the details on another
page, I think that the best way to do this is pass the ID< or Code, or
whatever, to the page via QueryString.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com
 
A

Angel

I guess by now you have your answer... But another approach

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs) Handles
GridView1.RowCommand
If e.CommandName.Equals("Select") Then
Dim RowIndex As Integer =
Convert.ToInt16(e.CommandArgument.ToString)
ViewState("PrimaryKey") =
GridView1.DataKeys(RowIndex).Value.ToString
BindDetailsView(ListItemType.Item)
End If
End Sub

You do need to set the gridview DataKeyNames with key field.

the wacky BindDetailsView(ListItemType.Item) is because the snippet
comes from a real working example where I dynamically set all the
properperies. I make no use of declarative stuff.

Hope it helps
 

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,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top