• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 671
  • Last Modified:

datarow changing in a detailsview

I have a details view that gets populated when an item is selected in a gridview. I don't know how to minipulate the data I am looking for something along these lines but I know the code is wrong.
Sub CustomersDatailsView_RowDataBound(ByVal sender As Object, ByVal e As DetailsViewRow) Handles evtInfo.ItemCreated
       If e.Cells(15).Text <> "" Then
            e.Cells(9).Text = "(Act) " & e.Cells(15).Text
           e.Cells(9).Text = "(Pln) " & e.Cells(9).Text
        End If
    End Sub

Open in new window

  • 2
1 Solution
Hi NickMalloy,

The thing is that DetailsView controls doesn't have RowDataBound event. It has a DataBound event instead and it is similar to RowDataBound.

When you add an event handler for DataBound then you can cast the "sender" object to DetailsView and then find the control in DetailsView that you want to access.

Here is an example:

Private Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
        If (CType(sender,DetailsView).CurrentMode = DetailsViewMode.Edit) Then
            Dim ddl As DropDownList = CType(CType(sender,DetailsView).FindContro,DropDownList)
            If (Not (ddl1) Is Nothing) Then
                'execute statements to add the desired data to it
            End If
        End If
    End Sub

NickMalloyAuthor Commented:
What if your not using controls, just basically databound rows or cells. How can you access those to grab the values.
I'm not sure. Maybe you can check the source of your page when it gets rendered and see what will be rendered in place of DetailsView.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now