Torna al Thread
Private Sub dtgLogin_RowUpdated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdatedEventArgs) Handles dtgLogin.RowUpdated
_RowEditing = False
End Sub
Private Sub dtgLogin_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles dtgLogin.RowCancelingEdit
_RowEditing = False
End Sub
Private Sub dtgLogin_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles dtgLogin.RowEditing
_RowEditing = True
End Sub
Private Sub dtgLogin_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles dtgLogin.RowDataBound
Select Case e.Row.RowType
Case DataControlRowType.DataRow
Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)
'Riga di inserimento
If Convert.ToInt32(drv("ID")) = -1 Then
'Tolgo la descrizione dell'IDUtente, che altrimenti sarebbe a -1
e.Row.Cells(GridColumnLogin.ID).Text = ""
'Setto la descrizione del pulsante Update a Insert
CType(e.Row.Cells(GridColumnLogin.CommandField).Controls(0), LinkButton).Text = "Insert"
'Tolgo il pulsante Cancel
e.Row.Cells(GridColumnLogin.CommandField).Controls.RemoveAt(2)
End If
End Select
End Sub
Private Sub dtsLogin_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs) Handles dtsLogin.Selected
If e.ExceptionHandled Then
'visualizzo l'eccezione
Me.pnmMessage.ShowMsg(e.Exception.Message, WebPages.Controls.PanelMsg.TipoAlert.Errors)
Me.panDati.Visible = False
Else
Dim dtLogin As DataTable = CType(e.ReturnValue, DataTable)
If Not _RowEditing Then
'Aggiungo la riga vuota per l'inserimento
Dim drNew As DataRow = dtLogin.NewRow()
drNew("ID") = -1
drNew("Desc") = ""
drNew("Username") = ""
drNew("Password") = ""
drNew("IDValuta") = 1
drNew("IDStato") = Spider.StatoLogin.Scaduto
dtLogin.Rows.Add(drNew)
'Seleziono in editing la riga per l'inserimento
Me.dtgLogin.EditIndex = dtLogin.Rows.Count - 1
End If
End If
End Sub