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
| Imports System.Data
Imports System.IO
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Dim StrConn As String = "Data Source=LLUXSAPP311;Initial Catalog=Staging2;Integrated Security=True"
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Appel la page du RequestStaging
Response.Redirect("./RequestStaging.aspx?Id1='" & Me.RadioButtonList1.SelectedValue & "'")
End Sub
Protected Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
'Appel la fonction pour charger la Droplist choix des templates
OpenAndRead("Select * From TblServerConfigBase WHERE MachineType='" & Me.RadioButtonList1.SelectedValue & "'")
End Sub
Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
'Appel la fonction pour charger la Droplist choix des templates
OpenAndRead("Select * From TblServerConfigBase WHERE MachineType='" & Me.RadioButtonList1.SelectedValue & "'")
End Sub
Private Sub OpenAndRead(ByVal StringSqlServer)
Dim Conn As New SqlConnection(StrConn)
Dim DtStaging As DataTable
'Ouvre la connexion Sql et charge les donnees Template en fonction du SELECT
Conn.Open()
Dim DaServerConfigBase As New SqlDataAdapter(StringSqlServer, Conn)
Dim DsStaging As New DataSet("TblServerConfigBase")
DaServerConfigBase.Fill(DsStaging, "TblServerConfigBase")
DtStaging = DsStaging.Tables("TblServerConfigBase")
Conn.Close()
Me.DropDownList1.AutoPostBack = True
Me.DropDownList1.DataSource = DtStaging
Me.DropDownList1.DataTextField = "TemplateServer"
Me.DropDownList1.DataBind()
Me.GridView1.DataSource = DtStaging
Me.GridView1.Columns("IdServerType").
'.Columns.Item("IdServerType").ToString()
Me.GridView1.DataBind()
****** Ici je souhaite lier un champs de ma table a un textbox ou un label **********
End Sub
End Class |
Partager