Please help me update a gridview using a pop up.
It couldn't get the primary key of the selected row.
these are my codes:
Protected Sub btnSaveRemarks_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSaveRemarks.Click
strSQL = "UPDATE CandidateScreening SET Remarks = @Remarks, Status = @Status WHERE ID ='" & lblID.Text & "'"
conn = New SqlConnection(ConfigurationManager.AppSettings("RRMS").ToString())
conn.Open()
With cmd
.Parameters.Clear()
.Parameters.AddWithValue("@Remarks", txtInitialInterviewRemarks.Text)
.Parameters.AddWithValue("@Status", ddlPassOrFail.SelectedItem.Value)
'.Parameters.AddWithValue("@SupportedDoc", txtMI.Text)
.Connection = conn
.CommandType = CommandType.Text
.CommandText = strSQL
Try
.ExecuteNonQuery()
Catch ex As Exception
Response.Write("Error: " & ex.Message)
End Try
End With
conn.Close()
updateInitial()
gvwInitInterview.DataBind()
ASPxPopupControl1.ShowOnPageLoad = False
End Sub
--------------
Protected Sub gvwInitInterview_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvwInitInterview.RowCommand
If e.CommandName = "Edit" Then
ASPxPopupControl1.ShowOnPageLoad = True
Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)
lblID.Text = gvwInitInterview.DataKeys(row.RowIndex).Value
End If
End Sub
---- Thank you.