Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/03/2005, 06:44
Avatar de Sayra
Sayra
 
Fecha de Ingreso: diciembre-2004
Mensajes: 365
Antigüedad: 20 años, 4 meses
Puntos: 1
Deleteboton y checkbox

Hola, pues incorpore a un datagrid unos checbox asi como el hotmail
la cosa es que quiero ahora que cuando le de al boton eleminar borre los registros que estan seleccionados con el checkbox

Pero de la foma que lo estoy haciendo, pues parece que reconec cual esta seleccionado pero no elimina el registro


Gracias de antemano

El codigo que estoy usando es este

Sub ShowSelections(sender As System.Object, e As System.EventArgs)
Dim dgItem As DataGridItem
Dim chkSelected As CheckBox
Dim strCustomerID As String
Dim BxsChkd As Boolean = False
Dim MyCommand As SqlCommand

'lblSelections.Text = "<br>Fooled Ya! The following rows were marked for deletion, "
'lblSelections.Text += "but not actually deleted:<br><br>"
For Each dgItem in MyDataGrid.Items
chkSelected = dgItem.FindControl("chkSelection")
If chkSelected.Checked Then
strCustomerID = CType(dgItem.FindControl("lblCustomerId"), Label).Text
'lblSelections.Text += "Customer ID: <b>" & strCustomerID & "</b><br>"
Dim deleteSQL As String = "DELETE from SolicitudEmpleo WHERE SolicitudID ="+ strCustomerID
MyCommand = New SqlCommand(deleteSQL, MyConnection)
end if
If BxsChkd = True Then
Try
MyCommand.ExecuteNonQuery()
OutputMsg.InnerHtml += "<font size=4><b>Store information has been deleted.</b></font>"
OutputMsg.Style("color") = "green"
Catch err As SqlException
OutputMsg.InnerHtml += err.Message.ToString
OutputMsg.Style("color") = "red"
End Try
bingrid (SelectCommand)
End If
Next
End Sub