473,772 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2096
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.hlnkModifica r.NavigateUrl
End Get
Set(ByVal Value)
Me.hlnkModifica r.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.FindCo ntrol(myCustomC ontrol_ID),
myCustomControl )
cc.SetURL= "Cv_1.aspx? x=" & Request("x")
HTH

Elton Wang

"je**********@g mail.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
5386
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 encrease one Control inside with ctl.Height>Section.Height automatically the Section adapt the Height
4
4231
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" runat="server"> <asp:HyperLink id="MyHLink" NavigateUrl='<%# geturl("123456") %>'
3
2408
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 intImgRatingCount < intImgRating intImgRatingCount += 1 Dim myimg As New Image
5
5008
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 tells me it won't work. Not sure how to do it. NavigateUrl="~/secure/Confirm.aspx?No=201, IDate=" & TxtBx1.text & ", ODate = " & TxtBx2.text
1
1636
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 out how to reference it so I can change the URL depending on which Stored procedure I bind to it during form load. Is there a way to change it URL via VB. This is in a content form within a master page if that makes any difference. Thank...
8
3026
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 way I'm going about doing this might be a little off. I'd appreciate some help. Below is the code I have thus far but I'm not sure how to reference the user control within the foreach loop. <asp:Panel ID="pnlRosterProfile" runat="Server" />
0
3440
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 will do some database updates, then I will use reflection to call a method in the parent (this.page) to load the new user control. Its at this point after it loads the new user control that it throws the error "The control must be placed inside...
2
10833
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 does not post back, nor do I want it to. After the user selects a document in the combo, I want a
4
3795
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 MasterPage.File's <asp:Hyperlink> control? Thanks,
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10106
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6716
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4009
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.