I am still not getting any values:
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
Dim Ques As TextBox = CType(e.CommandSource, TextBox)
Dim gvRow As GridViewRow = Ques.BindingContainer
Dim strValue As String = GridView1.DataKeys(gvRow.RowIndex)(0).ToString()
Dim QuesValueList As DropDownList = DirectCast((gvRow.Cells(3).FindControl("QuesValueList")), DropDownList)
End Sub
Private Sub LoadQuesValueList(QuesValueList As DropDownList)
Dim conn As SqlConnection
Dim comm As SqlCommand
Dim reader As SqlDataReader
Dim connectionString As String = ConfigurationManager.ConnectionStrings("ValueConn").ConnectionString
conn = New SqlConnection(connectionString)
comm = New SqlCommand("SELECT Item_Value, Item_Score FROM ValueID WHERE Value_Number_Scale = @strValue", conn)
Try
conn.Open()
reader = comm.ExecuteReader()
QuesValueList.DataSource = reader
QuesValueList.DataValueField = "Item_Score"
QuesValueList.DataTextField = "Item_Value"
QuesValueList.DataBind()
reader.Close()
Catch ex As Exception
End Try
End Sub
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:





by: HainKurtPosted on 2009-08-29 at 21:58:46ID: 25216408
first pass the dropdownlist as parameter to LoadQuesValueList, remove definition on line 25
eList As DropDownList)
Private Sub LoadQuesValueList(QuesValu
and before calling LoadQuesValueList, find the drop down in the grid and pass it to it...