Hello,
I am trying to use a dropdownlist bound to a datagrid on ItemType. I have no problem getting the values populated into the lists, but when I try to create the command OnSelectedIndexChange for the dropdownlist i get the error "BC30408: Method 'Public Sub Update(sender As Object, E As System.Web.UI.WebControls.DataGridCommandEventArgs)' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'."
I understand why I am getting that error; because the command is not part of the datagrid commands. Here is the code
How to I call a command that will get the value from the dropdownlist and write it to the database?
Any help is appreciated.
Thank you
I am trying to use a dropdownlist bound to a datagrid on ItemType. I have no problem getting the values populated into the lists, but when I try to create the command OnSelectedIndexChange for the dropdownlist i get the error "BC30408: Method 'Public Sub Update(sender As Object, E As System.Web.UI.WebControls.DataGridCommandEventArgs)' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'."
I understand why I am getting that error; because the command is not part of the datagrid commands. Here is the code
Code:
Public Sub Update(ByVal sender As System.Object, ByVal E As DataGridCommandEventArgs)
Dim Orgddl As DropDownList = E.Item.FindControl("OrganismDDL")
Dim cnn As SqlConnection
Dim cmd As SqlCommand
cnn = New SqlConnection(ConfigurationSettings.AppSettings("theConnection"))
cnn.Open()
Dim sSql As String
Dim x1 As String
x1 = CentralGrid.DataKeys.Item(E.Item.ItemIndex)
sSql = "Update Central_Line "
sSql += "SET "
sSql += "Infection = '" & OrgDdl.SelectedItem.Text & "' "
sSql += "Where Rec_No = " + x1
cmd = New SqlCommand(sSql, cnn)
cmd.ExecuteNonQuery()
LoadGrid()
End Sub
How to I call a command that will get the value from the dropdownlist and write it to the database?
Any help is appreciated.
Thank you