473,729 Members | 2,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to access controls on another aspx page

If I have a label on the Master Page that I would like to change its
text with a button on one of the content pages, Default.aspx... It's
giving me an error saying "Label1" is not found. Can you only find
controls on the current page.. ie Default.aspx.cs can only access
controls on the Default.aspx page?

~john

Sep 1 '06 #1
4 6260
the correct way is to have the master page implement an interface (defined
in app_code), for accessing its controls for which you need to create public
properties. then you can cast this.Master to. the cheap way is to include
<%@ MasterType %directive on the page, then just use this.Master t
accessing any controls that you have created public properties for.
-- bruce (sqlwork.com)

"~john" <So********@gma il.comwrote in message
news:11******** ************@h4 8g2000cwc.googl egroups.com...
If I have a label on the Master Page that I would like to change its
text with a button on one of the content pages, Default.aspx... It's
giving me an error saying "Label1" is not found. Can you only find
controls on the current page.. ie Default.aspx.cs can only access
controls on the Default.aspx page?

~john

Sep 1 '06 #2
Or you could use Master.FindCont rol().
Jan

"bruce barker (sqlwork.com)" <b_************ *************@s qlwork.comwrote
in message news:ew******** ******@TK2MSFTN GP03.phx.gbl...
the correct way is to have the master page implement an interface (defined
in app_code), for accessing its controls for which you need to create
public properties. then you can cast this.Master to. the cheap way is to
include <%@ MasterType %directive on the page, then just use this.Master
t accessing any controls that you have created public properties for.
-- bruce (sqlwork.com)

"~john" <So********@gma il.comwrote in message
news:11******** ************@h4 8g2000cwc.googl egroups.com...
>If I have a label on the Master Page that I would like to change its
text with a button on one of the content pages, Default.aspx... It's
giving me an error saying "Label1" is not found. Can you only find
controls on the current page.. ie Default.aspx.cs can only access
controls on the Default.aspx page?

~john

Sep 3 '06 #3
"~john" <So********@gma il.comwrote in message
news:11******** ************@h4 8g2000cwc.googl egroups.com...
If I have a label on the Master Page that I would like to change its
text with a button on one of the content pages, Default.aspx... It's
giving me an error saying "Label1" is not found. Can you only find
controls on the current page.. ie Default.aspx.cs can only access
controls on the Default.aspx page?
((Label)Master. FindControl("La bel1")).Text = "Hello";

But Bruce Barker's suggestion is probably more robust...
Sep 3 '06 #4
An easy solution to this problem is to create an IFrame within your
page, thus exposing the target page within the IFrame. The you can
click buttons on the other page from your parent page.

The Master
Mark Rae wrote:
"~john" <So********@gma il.comwrote in message
news:11******** ************@h4 8g2000cwc.googl egroups.com...
If I have a label on the Master Page that I would like to change its
text with a button on one of the content pages, Default.aspx... It's
giving me an error saying "Label1" is not found. Can you only find
controls on the current page.. ie Default.aspx.cs can only access
controls on the Default.aspx page?

((Label)Master. FindControl("La bel1")).Text = "Hello";

But Bruce Barker's suggestion is probably more robust...
Sep 5 '06 #5

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

Similar topics

4
5034
by: Rick Brown | last post by:
I have a form built in Access2000 that looks like the hardcopy in all ways including color. I now want to move this form to the company Intra-Net via ASP.NET. Is there a way to wizard this form over to .NET or can this form be rebuilt in a .NET editor retaining the same look? OR????? RICK
2
2355
by: Jon Hyland | last post by:
This might be a dumb question, but what is the best way for one instance of a user control to access properties of an instance of another user control? For example, let's say I have an instance of UserControlA (ucA1) and an instance of UserControlB (ucB1) on a particular ASP.NET page. UserControlA has a string property called StringA that gets generated from a DB call in it's Page_Load event. I want UserControlB to be able to access...
5
3050
by: djscratchnsniffing | last post by:
i know you can access an ascx's properties/methods from an aspx file. Let's say you have an aspx file with two code-behind files(ascx files). Can you access one of the ascx file's properties/methods from the other ascx file?
2
1976
by: N. Demos | last post by:
I have a user control with code behind of which two instances are created/declared in my aspx page. The aspx page has code behind also, as I need to access methods of the usercontrols on page submit. I've read several post here and articles on the web on this topic. What little I have learned from them is that you have to pre-compile the usercontrol in order to access it in the aspx code behind. I did this, compiling the usercontrol...
5
2876
by: c676228 | last post by:
Hi, I guess I am confused. In aspx script, I mean (you won't use Codebehind="enrollinfo.aspx.vb", but mix code with html and code together) You can access user control's property directly. Since I am useing visual studio .net, the html and code are seperated. I have the following aspx code which has two user controls: <%@ Register TagPrefix="Subway" TagName="Peopleinfo" Src="Peopleinfo.ascx" %> <%@ Register TagPrefix="Subway"...
2
1686
by: c676228 | last post by:
Hi, I created a group of user controls in an aspx form. which is as follow: <body> <form id="Form1" method="post" runat="server"> <SUBWAY:PEOPLEINFO id="Peopleinfo0" runat="server" Caption="Dependent Information"></SUBWAY:PEOPLEINFO> <p></p> <SUBWAY:PEOPLEINFO id="Peopleinfo1" runat="server" Caption="Dependent
52
9978
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
0
1837
JimWu
by: JimWu | last post by:
I have some problems in my code. The stutiation illustrate as the followsing statement. I use two pages, one, named "upload.aspx", is including several general html input tag, whose type are "file". That mean I create server file upload controls in this page. After user choose their files, wanted to upload, and click upload button, this page will be postbacked to another page, called "edit.aspx". The code as follows. edit.aspx
7
2294
by: Andy B | last post by:
I have a class I am creating for data access. I need to access controls from inside the class that are on a particular page. How do I do this? or is creating an instance of the page class and using FindControl the only way to do it?
0
8917
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
8761
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
9281
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...
0
9142
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
8148
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...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
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();...
1
3238
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
2680
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.