Welcome to Dream.In.Code
Become an Expert!

Join 150,195 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,032 people online right now. Registration is fast and FREE... Join Now!




Visual Web Developer 2008 Express

 
Reply to this topicStart new topic

Visual Web Developer 2008 Express, Copying values from a selected Gridview to a DetailsView

esmith236
12 Sep, 2008 - 08:18 AM
Post #1

New D.I.C Head
*

Joined: 27 Aug, 2008
Posts: 2



[code] Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
DetailsView1.DefaultMode = DetailsViewMode.ReadOnly
If (DetailsView1.PageCount = 0) Or (DetailsViewMode.Insert) Then
DetailsView1.ChangeMode(DetailsViewMode.Insert)
DirectCast(DetailsView1.Rows(0).Cells(1).Controls(0), TextBox).Text = GridView1.SelectedRow.Cells(5).Text
DirectCast(DetailsView1.Rows(1).Cells(1).Controls(0), TextBox).Text = GridView1.SelectedRow.Cells(1).Text
End If
End Sub[code]

This code does not work. Upon "Insert" the form should display with the first two values copied from the GridView Selected Row. The DirectCast was suggested from the asp.net forums group. I'm not familiar with it. Also the Controls(0) code....
Any suggestions here?
Thanks,
esmith236
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:36AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month