HShbib
HShbib

Reputation: 1841

ASP: Assign a Gridview Value to a label

How can i assign a value in the Gridview to a label?

Dim Command3 As New SqlCommand
            Adapter = New SqlDataAdapter("Select [Parking_Cost] FROM Parking Where [Parking_ID] = @Parking_ID2", myConn)
            Adapter.SelectCommand.Parameters.AddWithValue("@Parking_ID2", Parking_ID2)

            Adapter.Fill(Dataset)
            Total.DataSource = Dataset
            Label14.DataBind()
            Total.DataBind()

Tried binding did not work

Any ideas?

Regards.

Upvotes: 0

Views: 1060

Answers (1)

Jack
Jack

Reputation: 8941

You can do something like this. If there's only one Datatable in your Dataset then table index is 0.

label14.text = Datatset.Tables(table index).Rows.Item(row index)(column index).ToString

Upvotes: 1

Related Questions