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
|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
' Load Team Categories in DropDownList
equipecat.Controls.Add(EquipeHelpers.getCategories(ViewData("Category")))
' Load Team Trainers (many-to-many)
For Each entraineur As DAL.Horaire_dev.EntraineursEquipe In ViewData("Entraineurs")
' Name TextBox
Dim name As New TextBox
name.ID = "EntName" & entraineur.Id
name.Text = entraineur.HoEntraineur.Nom
' Delete Label
Dim del As New Label
del.ID = "EntDel" & entraineur.Id
del.Text = "Supprimer"
' Add Controls
PlaceHolder1.Controls.Add(name)
PlaceHolder1.Controls.Add(EquipeHelpers.getEntTypes(entraineur.Entraineur)) ' Type DropDownList
PlaceHolder1.Controls.Add(New LiteralControl("<small><a href=/Equipes/EntDelete/" & entraineur.Id & ">"))
PlaceHolder1.Controls.Add(del)
PlaceHolder1.Controls.Add(New LiteralControl(" </a></small><br />"))
Next
End If
End Sub
Protected Sub btnsavee_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsavee.Click
For Each entraineur As DAL.Horaire_dev.EntraineursEquipe In ViewData("Entraineurs")
Try
Dim textBox As New TextBox
textBox = PlaceHolder1.FindControl("EntDel" & entraineur.Id)
MsgBox(textBox.Text)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Next
Response.Redirect("/Equipes/Save/" & ViewData("id"))
End Sub |
Partager