How can i get the current selected value of another dropdown list column in GridView basing from one selected DropDownList.
i have two DropDownList columns class and stream.
i wanted to get the value at dropdown list class upon selecting the current value stream.
my code on selected in stream.
Protected Sub ddlstream_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim dropDownList As DropDownList = CType(sender, DropDownList)
' Dim selectedCity As String = DataBinder.Eval(e.Row.DataItem, "City").ToString()
'Get the ID of the DropDownList.
Dim k As String
Dim id As String = dropDownList.SelectedValue
k = dropDownList.SelectedItem.Text
' ClientScript.RegisterClientScriptBlock(Me.GetType(), "alert", "alert('" & dropDownList.SelectedItem.Text & "');", True)
Dim index As Integer
Dim ddl As Object = TryCast(Stockbooks.Rows(index).FindControl("lblCountry2"), DropDownList)
' Dim text As String = ddl.SelectedItem.Text
'Dim value As String = ddl.SelectedItem.Value
Dim country As String = TryCast(Stockbooks.SelectedRow.FindControl("lblCountry2"), Label).Text
Using Conb As New SqlConnection(conString)
Conb.Open()
Using cmd As New SqlCommand
cmd.Connection = Conb
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "Controlclasscream"
cmd.Parameters.Add("@c", SqlDbType.Int).Value = country
cmd.ExecuteReader()
End Using
End Using
End Sub