473,788 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change MasterPage.File HyperLink in Content Page

I have an <asp:HyperLinkc ontrol 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 "NavigateUr l" value for a MasterPage.File 's <asp:Hyperlin k>
control?

Thanks,
Oct 29 '08 #1
4 3796
"Greg" <Ac**********@n ewsgroups.nospa mwrote in message
news:6D******** *************** ***********@mic rosoft.com...
I have an <asp:HyperLinkc ontrol 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 "NavigateUr l" value for a MasterPage.File 's <asp:Hyperlin k>
control?
Master.FindCont rol("MyMasterHy perLink").Navig ateUrl = http://www.mysite.com;
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 29 '08 #2
On Wed, 29 Oct 2008 22:58:36 +0100, Mark Rae [MVP]
<ma**@marknospa mrae.netwrote:
Master.FindCont rol("MyMasterHy perLink").Navig ateUrl =
http://www.mysite.com;
An explicit cast will probably help the compiler get it right :-)

((HyperLink)Mas ter.FindControl ("MyMasterHyper Link")).Navigat eUrl =
"http://www.mysite.com" ;

--
Joern Schou-Rode
http://malamute.dk/
Oct 29 '08 #3
"Joern Schou-Rode" <js*@malamute.d kwrote in message
news:op.ujs40uu w31zpn8@marvin. ..
>Master.FindCon trol("MyMasterH yperLink").Navi gateUrl =
http://www.mysite.com;

An explicit cast will probably help the compiler get it right :-)

((HyperLink)Mas ter.FindControl ("MyMasterHyper Link")).Navigat eUrl =
"http://www.mysite.com" ;
Apologies - you're correct.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 29 '08 #4
This worked great. Much thanks.

"Joern Schou-Rode" wrote:
On Wed, 29 Oct 2008 22:58:36 +0100, Mark Rae [MVP]
<ma**@marknospa mrae.netwrote:
Master.FindCont rol("MyMasterHy perLink").Navig ateUrl =
http://www.mysite.com;

An explicit cast will probably help the compiler get it right :-)

((HyperLink)Mas ter.FindControl ("MyMasterHyper Link")).Navigat eUrl =
"http://www.mysite.com" ;

--
Joern Schou-Rode
http://malamute.dk/
Oct 30 '08 #5

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

Similar topics

2
1141
by: Arjen | last post by:
Hi, My mastepage can use two css files. Now page 1 needs to use the masterpage with css file 1 and page 2 needs to use the masterpage with css file 2. How can the page say that it wants to use css file 1 or 2? I don't want to add the css file inside the pages. I hope that this is posible with a simple setting in this line:
2
5156
by: Rob Roberts | last post by:
In a VS2005 ASP.NET project, I'm trying to find a way to change which css file is linked in based on the browser type. I'd like to use one css file for IE browsers, and a different one for all other browsers. I'm using a MasterPage. I added a Literal control to the Head section of the MasterPage, and then in the Page_Load event I set its Text property to set up the desired link, like this: StyleSheetLiteral.Text = "<link...
2
7699
by: dawg1998 | last post by:
I have a page that creates dynamic textboxes based on the number of fields a user chooses to fill out. This process worked great when the page was standalone. However, when I move to a Content/MasterPage setup, the MasterPage Form seems to be interfering with the ability of my code to retrieve the value in the dynamic control. Are there any ideas on why this is happening or how to work-around the problem? What is the syntax to find a...
2
1924
by: K B | last post by:
Hi, I created a simple MasterPage, then created a content page. I've checked that my MasterPage HTML is correct, but when I run the content page, I get a blank page in IE. My content page is simply two placeholders and a label control. TIA, Kit <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="MainMenu.aspx.vb" Inherits="MainMenu" title="Untitled Page" %> <asp:Content ID="Content1"...
9
16273
by: ad | last post by:
Hi, How can I dynamically change the MasterPager of a web page?
6
6175
by: =?Utf-8?B?QmVuIFIu?= | last post by:
Hi, WHen I specify my master page in the page's @Page directive, no problems. However, when I put it ias an attribute in Web.config's page element, the designer fails. It just says "Error Creating Control - Content. Content controsl can only be used in a content page." I know that there's an issue w/ nested masters, but I'm only trying to use one. Interestingly, if I run the site, it builds and displays properly despite this error. Any...
7
13046
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be changed from default.aspx to students.aspx. I tried to create a subroutine in MasterPage.master.vb to do it. The code is as following. But, the default.aspx's content is shown in MasterPage even I clicked the student button.
2
2209
by: =?Utf-8?B?RGFsZQ==?= | last post by:
I have an app with a MasterPage. In the MasterPage is a user control with several public properties and methods that I want exposed to the content page. Rather than writing several redirection methods to expose the properties, I would rather just expose the user control as a property of the MasterPage. The problem is, when I compile, I get an exception on the content page: The type 'MessageBlock.MessageBlock' is defined in an...
7
2133
by: John | last post by:
Hi there, I have a CSS based menu in a master page that uses class attributes to determine which item is currently selected. So, for example if the Homepage is currently the active page then its list item tag carries a class attribute of "current", while all other items carry one of "select". What I want to know is what is the best approach to change these attributes based on the current content page. Should I be changing the...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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
10110
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
9967
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
6750
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.