1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
Partial Class pouet
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Call init_GV()
End Sub
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
With SqlDataSource1
Dim SSoldeModif, SGAR, SRecup, sprov As String
SGAR = CType((GridView1.Rows(e.RowIndex).Cells(1).Controls(0)), TextBox).Text
SSoldeModif = CType((GridView1.Rows(e.RowIndex).Cells(2).Controls(0)), TextBox).Text
SRecup = CType((GridView1.Rows(e.RowIndex).Cells(3).Controls(0)), TextBox).Text
sprov = CType((GridView1.Rows(e.RowIndex).Cells(4).Controls(0)), TextBox).Text
.UpdateParameters.Add("GAR_SURF", SGAR)
.UpdateParameters.Add("SOLDE_MODIF", SSoldeModif)
.UpdateParameters.Add("RECUP_ESTIMEE", SSoldeModif)
.UpdateParameters.Add("provision", sprov)
End With
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
' Confirms that an HtmlForm control is rendered for the specified ASP.NET server control at run time.
End Sub
Protected Sub init_GV()
Dim colmodif As New CommandField
Dim colSoldeModif, colRecup, colprov As New BoundField
Dim colGarSurf As New TemplateField
With SqlDataSource1
.ConnectionString = ConfigurationManager.AppSettings("CnxFormatString") & "database=" & ConfigurationManager.AppSettings("BaseAppli") & ";"
.SelectCommand = "SELECT GAR_SURF, NUCOI, COETB, NUMDEMANDE, SOLDE_MODIF, RECUP_ESTIMEE, provision FROM T_COMPTES where numdemande='20090002' and coetb='009'"
.UpdateCommand = "UPDATE T_COMPTES SET GAR_SURF=@GAR_SURF, SOLDE_MODIF=@SOLDE_MODIF, RECUP_ESTIMEE=@RECUP_ESTIMEE, provision=@provision WHERE NUCOI=@NUCOI AND COETB=@COETB and numdemande='20090002'"
End With
GridView1.Columns.Clear()
With colmodif
.ShowEditButton = True
End With
With colGarSurf
.ItemTemplate = New DynamicLblTemplate
.EditItemTemplate = New DynamicTBTemplate
End With
With colSoldeModif
.DataField = "SOLDE_MODIF"
End With
With colRecup
.DataField = "RECUP_ESTIMEE"
End With
With colprov
.DataField = "provision"
End With
With GridView1
.BackColor = Color.FromName("White")
.BorderColor = Color.FromArgb(153, 153, 153)
.BorderStyle = 0
.BorderWidth = New Unit(1, UnitType.Pixel)
.CellPadding = 3
.Font.Name = "Arial"
.Font.Size = New FontUnit(10, UnitType.Pixel)
.ShowFooter = True
.FooterStyle.Font.Bold = True
.FooterStyle.Font.Size = New FontUnit(12, UnitType.Pixel)
.GridLines = 2
'Comportement et lien aux données
.AllowSorting = True
.AllowPaging = True
.PageSize = 100
.PagerSettings.PageButtonCount = 15
.PagerSettings.Position = PagerPosition.TopAndBottom
'style des parties annexes (entête, pied,...)
.FooterStyle.BackColor = Color.FromArgb(204, 204, 204)
.FooterStyle.ForeColor = Color.FromName("Black")
.RowStyle.BackColor = Color.FromArgb(238, 238, 238)
.RowStyle.ForeColor = Color.FromName("Black")
.PagerStyle.BackColor = Color.FromArgb(135, 206, 235)
.PagerStyle.ForeColor = Color.FromName("Black")
.PagerStyle.HorizontalAlign = HorizontalAlign.Center
.SelectedRowStyle.BackColor = Color.FromArgb(0, 138, 140)
.SelectedRowStyle.Font.Bold = "True"
.SelectedRowStyle.ForeColor = Color.FromName("White")
.HeaderStyle.BackColor = Color.FromArgb(135, 206, 235)
.HeaderStyle.Font.Bold = "True"
.HeaderStyle.ForeColor = Color.FromName("White")
.AlternatingRowStyle.BackColor = Color.FromName("Gainsboro")
.PagerSettings.Mode = 3
.DataSourceID = "SqlDataSource1"
.DataKeyNames = New String() {"NUCOI", "COETB", "numdemande"}
.AutoGenerateColumns = "false"
.Columns.Add(colmodif)
.Columns.Add(colGarSurf)
.Columns.Add(colSoldeModif)
.Columns.Add(colprov)
.Columns.Add(colRecup)
.DataBind()
End With
End Sub
End Class |
Partager