ArneMedlem sedan maj 2000267 inlägg Har en PreviousPage.FindControl som fungerar utan problem på sidor som ej är MasterPage.
Använder jag mig av MasterPage så fungerar ej FindControl?
Page.PreviousPage fungerar, men ej PreviousPage.FindControl
Vad gör jag för fel när jag använder MasterPage?
If Not Page.PreviousPage Is Nothing Then
Dim SourceLabel As Label
SourceLabel = CType(PreviousPage.FindControl("lblMyId"), Label)
If Not SourceLabel Is Nothing Then
lblPickUpId.Text = SourceLabel.Text
End If
Else
lblPickUpId.Text = lblPickUpId.Text
End If
TravoniMedlem sedan okt. 20041 556 inlägg Testa detta:
SourceLabel = CType(PreviousPage.FindControlByID(PreviousPage.Controls,"lblMyId"), Label)
Public Shared Function FindControlByID(ByVal controls As ControlCollection, ByVal id As String) As Control
Dim found As Control = Nothing
For Each control As Control In controls
If control.ID = id Then
Return control
End If
If control.HasControls() Then
found = FindControlByID(control.Controls, id)
If found IsNot Nothing Then
Return found
End If
End If
Next
Return found
End Function
ArneMedlem sedan maj 2000267 inlägg System.Web.UI.Page
Jag får: 'FindControlByID' is not a member of 'System.Web.UI.Page'.
Hittar inte vad det beror på.......
TravoniMedlem sedan okt. 20041 556 inlägg SourceLabel = CType(Me.FindControlByID(PreviousPage.Controls,"lblMyId"), Label)