First of all, it's better to directly assign to and get data from NavigateUrl
rather than via PreRender event:
Public Property SetURL() As String
Get
Return Me.hlnkModificar.NavigateUrl
End Get
Set(ByVal Value)
Me.hlnkModificar.NavigateUrl = Value
End Set
End Property
Seconly, you should get reference of usercontrol rather than create a new
usercontrol instance.
Dim cc As myCustomControl = CType(Me.FindControl(myCustomControl_ID),
myCustomControl)
cc.SetURL= "Cv_1.aspx?x=" & Request("x")
HTH
Elton Wang
"je**********@gmail.com" wrote:
I created a user control containing containing a few hyperlinks.
How can I change the NavigateUrl inside the user control ?
So far I did the following:
1) In the custom control
- Public Property SetURL()
- Get
- RE\\> End Get
- Set(ByVal Value)
- sModificarURL = Value
- End Set
- End Property
- Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
- System.EventArgs) Handles MyBase.PreRender
- Me.hlnkModificar.NavigateUrl = sModificarURL
- End Sub
-
2) In the page containing the control:
- Dim cc As New myCustomControl
- cc.SetURL= "Cv_1.aspx?x=" & Request("x")
-
My problem is that at PreRender the value I passed down to the property
doesn't exist any more.
Any other way of achieving this ?
Jean-Luc
www.corobori.com