Hellow!


I'm having a problem to get the inserted values from the detailsview. I've tried the following things:

// Get Value from DropDown
        int TopicID = 0;
        foreach (DetailsViewRow row in ItemsDetailsView.Rows)
        {
            if (row.Cells[0].Text == "Topic")
            {
                 DropDownList TopicDropDown = (DropDownList)row.Cells[1].FindControl("Topic_TopicIDList");
                 TopicID = int.Parse(TopicDropDown.SelectedValue.ToString());
            }


        }

            MsgBox(CType(DetailsView1.Rows(1).Cells(0).Controls(0), Label))




            For Each row As DetailsViewRow In DetailsView1.Rows

                Dim cell1 As TableCell = row.Cells(1)

                Dim value1 As String

                value1 = cell1.Text

                MsgBox(value1)


            Next

            Dim item As New DetailsViewItem(col.ColumnName, row(index).ToString(), col.DataType.ToString(), col.DefaultValue)
          MsgBox(DetailsView1.Rows(1).Controls(0).)


            MsgBox([Enum].GetValues)







            tb = DetailsView1.FindControl("Categorie")
            s = tb.Text

            MsgBox(s.ToString)

            For Each dvr As DetailsViewRow In DetailsView1.Rows
                If dvr.Cells.Count = 2 Then
                    If dvr.Cells(1).Controls.Count > 0 Then
                        Dim txt As TextBox
                        txt = dvr.Cells(1).Controls(0)
                        MsgBox("ID: " & txt.ID)
                        MsgBox("Text: " & txt.Text.ToString)
                    End If
                End If
            Next

            For i As Integer = 0 To e.Values.Count - 1
                If e.Values(i) IsNot Nothing Then
                    e.Values(i) = Server.HtmlEncode(e.Values(i).ToString())
                    ' MsgBox(Server.HtmlEncode(e.Values(i).ToString()))

                End If
            Next

Nothing works, so what I did is I have a gridview and when I select an item there it shows in detail in the DetailsView.

Well that works, but now I want to add new Items via the detailsview and that doesn't work since the detailsview is not connected to my database I just want to get the values via :


Private Sub DetailsView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs) Handles DetailsView1.ItemInserting


So I can re input them via SQL.


Please Help Me!!!


Screens:

http://i913.photobucket.com/albums/ac339/VisualTouchEU/imagescreen1.png


http://i913.photobucket.com/albums/ac339/VisualTouchEU/imagescreen2.png

Full code on pastebin:

http://pastebin.com/iaCGwWxa

Recommended Answers

All 2 Replies

Did you set breakpoints and see what code is executed exactly and values assigned to the variables. e.g.:

if (row.Cells[0].Text == "Topic")

There you are accessing first Column, so what is the text value? Is that your first column?
Can you share your DV markup?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.