Puis dans un fichier vb global, 'modif_controls.vb' je voudrais affecter une valeur à cette commande:
lblCreer.Text = "test" par exemple
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionModifControl(Me)
Public Sub ModifControl(page As System.Web.UI.Page) Label lblCreer = CType(page.FindControl("lblCreer"),Label) ' la suite ... lblCreer.Text = "toto" End Sub
if lblcreer is nothing then return false end if lblcreer.text = "test"
Page.FindControl("Content1") Dim lbl_sent As New Label lbl_sent = CType(Page.FindControl("LbComp"), Label) If lbl_sent Is Nothing Then Return False End If lbl_sent.Text = "test"
Try Dim Conetent1 As ContentPlaceHolder = DirectCast(Page.FindControl("Content1"), ContentPlaceHolder) Dim lbl_sent As Label = DirectCast(Conetent1.FindControl("LbComp"), Label) lbl_sent.Text = "test" Catch Ex As Exception ' End Try
Try Dim CPH1 As ContentPlaceHolder = DirectCast(Page.Master.FindControl("ContentPlaceHolder1"), ContentPlaceHolder) Dim lbl_sent As Label = DirectCast(CPH1.FindControl("LbComp"), Label) lbl_sent.Text = "test" Catch Ex As Exception ' End Try