473,385 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How can I change the NavigateUrl inside the user control ?

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

Expand|Select|Wrap|Line Numbers
  1. Public Property SetURL()
  2. Get
  3. SetURL= sModificarURL
  4. End Get
  5. Set(ByVal Value)
  6. sModificarURL = Value
  7.  
  8. End Set
  9. End Property
  10.  
  11. Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
  12. System.EventArgs) Handles MyBase.PreRender
  13. Me.hlnkModificar.NavigateUrl = sModificarURL
  14. End Sub
  15.  
2) In the page containing the control:
Expand|Select|Wrap|Line Numbers
  1. Dim cc As New myCustomControl
  2. cc.SetURL= "Cv_1.aspx?x=" & Request("x")
  3.  
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

Mar 8 '06 #1
1 2080
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

Expand|Select|Wrap|Line Numbers
  1.      Public Property SetURL()
  2.          Get
  3.              RE\\>         End Get
  4.          Set(ByVal Value)
  5.              sModificarURL = Value
  6.          End Set
  7.      End Property
  8.      Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
  9.  System.EventArgs) Handles MyBase.PreRender
  10.          Me.hlnkModificar.NavigateUrl = sModificarURL
  11.      End Sub
  12.  

2) In the page containing the control:
Expand|Select|Wrap|Line Numbers
  1.          Dim cc As New myCustomControl
  2.          cc.SetURL= "Cv_1.aspx?x=" & Request("x")
  3.  

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

Mar 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ALESSANDRO Baraldi | last post by:
Hi and Good Sunday. Have i any way to Reduce at Runtime, with no change on Design View, the Height property of Detail_Section on my Report.....? The Section Property is Read_Only but if i...
4
by: Tomek R. | last post by:
Hello ! This post does'nt regard column hyperlink. I just have single hyperlink and want to create it's NavigateUrl dynamically. This is my test page <form id="Form1" method="post"...
3
by: euan | last post by:
Hey guys, I am just playing around with asp.net 2.0 and I was reading about the image control (for mobile designer) and thought that would be handy. So I have created: Do While...
5
by: Vear | last post by:
Sorry, very Newbie question here. I don't know what I'm doing wrong. I have to use a <asp:hyperlink> to go to another page. I want to pick up the value in a text box. This is what I've tried and It...
1
by: Vear | last post by:
I have a gridview inside a content placeholder that has the first column as a hyperlink. I changed it from a Hyperlinkfield to a Template field so I could name the hyperlink control. I can't figure...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
0
by: davidr | last post by:
Hi, I have a panel that I load user Control in no problem. The problem arrises when I do a post back on one of these user controls. I have button it does a click event. In this click event I...
2
by: Radu | last post by:
Hi, I have a "select" control named "cboSelectScorecardType", defined as <select id="cboSelectScorecardType" size="1" runat="server"> </select> which shows a list of files on my drive. It...
4
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have an <asp:HyperLinkcontrol on my master page shown as "Return" I want this control to always return to a specific page I set in code. How can I change the "NavigateUrl" value for a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.