Array
(
)

EXCLUIR REGISTRO EM TABELA FEITA EM TEMPO DE EXECUÇÃO

Lprc_forum
   - 28 nov 2008

Olá pessoal,
Eu criei uma tabela em tempo de execução e dentro dela, criei também uma coluna de exclusão. O problema é o seguinte: Ela está dentro de um While SReader.read() ... end while e ao momento em que vai gerando as linhas, ao passar pela coluna de exclusão, ela apaga o registro. Existe alguma maneiira de ela ser criada e apagar apens o registro que eu clicar? Vou disponibilizar o código abaixo.

#Código



Dim Cont As Integer = 0
While sReader.Read()
Cont = Cont + 1
If (Cont Mod 2) = 0 Then
cor = System.Drawing.Color.White
Else
cor = System.Drawing.Color.Lavender
End If
´------------------------------------------------------------------------
´CRIA LINHA E COLUNAS PARA RECEBER OS VALORES DO BANCO
´------------------------------------------------------------------------
Dim linhaReg1 As New TableRow()

Dim CelReg1 As New TableCell()
Dim CelReg2 As New TableCell()
Dim CelReg3 As New TableCell()
Dim CelReg4 As New TableCell()
Dim CelReg5 As New TableCell()
Dim CelReg6 As New TableCell()
Dim CelReg7 As New TableCell()
Dim CelReg8 As New TableCell()
Dim CelReg9 As New TableCell()
Dim CelReg10 As New TableCell()

linhaReg1 = New TableRow
´-----------------------------------------------------------------------------------------------------------
CelReg1 = New TableCell
CelReg1.Text = IIf(sReader("NomeUsu") Is System.DBNull.Value, " ", sReader("NomeUsu"))
CelReg1.BackColor = cor
CelReg1.ForeColor = Navy
CelReg1.Font.Bold = False
CelReg1.Height = 13
CelReg1.HorizontalAlign = HorizontalAlign.Left
linhaReg1.Cells.Add(CelReg1)
´-----------------------------------------------------------------------------------------------------------
CelReg2 = New TableCell
CelReg2.Text = IIf(sReader("empresa") Is System.DBNull.Value, " ", sReader("empresa"))
CelReg2.BackColor = cor
CelReg2.ForeColor = Navy
CelReg2.Font.Bold = False
CelReg2.HorizontalAlign = HorizontalAlign.Left
linhaReg1.Cells.Add(CelReg2)
´-----------------------------------------------------------------------------------------------------------
CelReg3 = New TableCell
CelReg3.Text = IIf(sReader("grupousu") Is System.DBNull.Value, " ", sReader("grupousu"))
CelReg3.BackColor = cor
CelReg3.ForeColor = Navy
CelReg3.Font.Bold = False
CelReg3.HorizontalAlign = HorizontalAlign.Left
linhaReg1.Cells.Add(CelReg3)
´-----------------------------------------------------------------------------------------------------------
CelReg4 = New TableCell
CelReg4.Text = IIf(sReader("loginUsu") Is System.DBNull.Value, " ", sReader("loginUsu"))
CelReg4.BackColor = cor
CelReg4.ForeColor = Navy
CelReg4.Font.Bold = False
CelReg4.HorizontalAlign = HorizontalAlign.Left
linhaReg1.Cells.Add(CelReg4)
´-----------------------------------------------------------------------------------------------------------
CelReg5 = New TableCell
CelReg5.Text = IIf(sReader("StatusSenhaUsu") Is System.DBNull.Value, " ", sReader("StatusSenhaUsu"))
CelReg5.BackColor = cor
CelReg5.ForeColor = Navy
CelReg5.Font.Bold = False
CelReg5.HorizontalAlign = HorizontalAlign.Center
linhaReg1.Cells.Add(CelReg5)
´-----------------------------------------------------------------------------------------------------------
CelReg6 = New TableCell
CelReg6.Text = IIf(sReader("PodeBloq") Is System.DBNull.Value, " ", sReader("PodeBloq"))
CelReg6.BackColor = cor
CelReg6.ForeColor = Navy
CelReg6.Font.Bold = False
CelReg6.HorizontalAlign = HorizontalAlign.Center
linhaReg1.Cells.Add(CelReg6)
´-----------------------------------------------------------------------------------------------------------
CelReg7 = New TableCell
CelReg7.Text = IIf(sReader("QtErrosBloq") Is System.DBNull.Value, " ", sReader("QtErrosBloq"))
CelReg7.BackColor = cor
CelReg7.ForeColor = Navy
CelReg7.Font.Bold = False
CelReg7.HorizontalAlign = HorizontalAlign.Center
linhaReg1.Cells.Add(CelReg7)
´-----------------------------------------------------------------------------------------------------------
CelReg8 = New TableCell
CelReg8.Text = IIf(sReader("Criptografar") Is System.DBNull.Value, " ", sReader("Criptografar"))
CelReg8.BackColor = cor
CelReg8.ForeColor = Navy
CelReg8.Font.Bold = False
CelReg8.HorizontalAlign = HorizontalAlign.Center
linhaReg1.Cells.Add(CelReg8)
´-----------------------------------------------------------------------------------------------------------
CelReg9 = New TableCell
CelReg9.BackColor = cor
CelReg9.ForeColor = Navy
CelReg9.Font.Bold = False
CelReg9.HorizontalAlign = HorizontalAlign.Center
Dim Editar As New HyperLink
Editar.Text = "Editar"
Editar.NavigateUrl = "ADM_Form.aspx?xxxx=" & Cripta_Id(sReader("idUsu"))
CelReg9.Controls.Add(Editar)
linhaReg1.Cells.Add(CelReg9)
´-----------------------------------------------------------------------------------------------------------
[color=red]
CelReg10 = New TableCell
CelReg10.BackColor = cor
CelReg10.ForeColor = Navy
CelReg10.Font.Bold = False
CelReg10.HorizontalAlign = HorizontalAlign.Center
Dim Excluir As New LinkButton
Excluir.Text = "Excluir"
Excluir.OnClientClick = Exclui_Usuario(sReader("idUsu"))
Excluir.CommandName = oi()
CelReg10.Controls.Add(Excluir)
[/color]
linhaReg1.Cells.Add(CelReg10)
DataTable.Rows.Add(linhaReg1)
End While



Abçs


Fabiose
   - 05 dez 2008

Ola colega, vc conseguiu resolver esta questão?

[]s


Lprc_forum
   - 05 dez 2008

Ainda não meu camarada!!
Até então ninguém respondeu, nem aqui, nem em outro forum.

Abçs