473,387 Members | 1,540 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,387 software developers and data experts.

Referencing a control on a different page

Hello,

I am developing a c# asp.net application. I have 2 forms.

In the first webform ('header') i have a label.
I want to reference that label from a different form ('user'), in order to
change its' text.

How can i do that?

Thank you,
Dana
Nov 28 '05 #1
6 1399
You cannot simply access other pages without actually transferring control
to that second page. Each page is self-contained.

The real question is, why would you need to change the text on the second
page that will not be displayed during the current page request?

"dana lees" <da***@idc.ac.il> wrote in message
news:ut****************@TK2MSFTNGP14.phx.gbl...
Hello,

I am developing a c# asp.net application. I have 2 forms.

In the first webform ('header') i have a label.
I want to reference that label from a different form ('user'), in order to
change its' text.

How can i do that?

Thank you,
Dana

Nov 28 '05 #2
On 'header' i have a label that shows the number of current users in the
system.
On 'User.aspx' i can add or delete a user and then i would like to refresh
the label on the first page because the number of users on it is no longer
valid...

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You cannot simply access other pages without actually transferring control
to that second page. Each page is self-contained.

The real question is, why would you need to change the text on the second
page that will not be displayed during the current page request?

"dana lees" <da***@idc.ac.il> wrote in message
news:ut****************@TK2MSFTNGP14.phx.gbl...
Hello,

I am developing a c# asp.net application. I have 2 forms.

In the first webform ('header') i have a label.
I want to reference that label from a different form ('user'), in order to change its' text.

How can i do that?

Thank you,
Dana


Nov 28 '05 #3
Such information should be saved in an application variable or in an
external file or database that will be read when the header loads and is
displayed.

"dana lees" <da***@idc.ac.il> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
On 'header' i have a label that shows the number of current users in the
system.
On 'User.aspx' i can add or delete a user and then i would like to refresh
the label on the first page because the number of users on it is no longer
valid...

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You cannot simply access other pages without actually transferring
control
to that second page. Each page is self-contained.

The real question is, why would you need to change the text on the second
page that will not be displayed during the current page request?

"dana lees" <da***@idc.ac.il> wrote in message
news:ut****************@TK2MSFTNGP14.phx.gbl...
> Hello,
>
> I am developing a c# asp.net application. I have 2 forms.
>
> In the first webform ('header') i have a label.
> I want to reference that label from a different form ('user'), in order to > change its' text.
>
> How can i do that?
>
> Thank you,
> Dana
>
>



Nov 28 '05 #4
So i have to reload header every time i add/delete a user?
How do i reload it from a different form?

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Such information should be saved in an application variable or in an
external file or database that will be read when the header loads and is
displayed.

"dana lees" <da***@idc.ac.il> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
On 'header' i have a label that shows the number of current users in the
system.
On 'User.aspx' i can add or delete a user and then i would like to refresh the label on the first page because the number of users on it is no longer valid...

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
You cannot simply access other pages without actually transferring
control
to that second page. Each page is self-contained.

The real question is, why would you need to change the text on the second page that will not be displayed during the current page request?

"dana lees" <da***@idc.ac.il> wrote in message
news:ut****************@TK2MSFTNGP14.phx.gbl...
> Hello,
>
> I am developing a c# asp.net application. I have 2 forms.
>
> In the first webform ('header') i have a label.
> I want to reference that label from a different form ('user'), in
order to
> change its' text.
>
> How can i do that?
>
> Thank you,
> Dana
>
>



Nov 28 '05 #5
Okay, I am confused. What is the header? Is is a user control or a page in
an iframe or what?

Pages are always reloaded when a request is made to the server. Not sure
what you mean by "reload header every time".
"dana lees" <da***@idc.ac.il> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
So i have to reload header every time i add/delete a user?
How do i reload it from a different form?

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Such information should be saved in an application variable or in an
external file or database that will be read when the header loads and is
displayed.

"dana lees" <da***@idc.ac.il> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
> On 'header' i have a label that shows the number of current users in
> the
> system.
> On 'User.aspx' i can add or delete a user and then i would like to refresh > the label on the first page because the number of users on it is no longer > valid...
>
> "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
> news:%2******************@tk2msftngp13.phx.gbl...
>> You cannot simply access other pages without actually transferring
>> control
>> to that second page. Each page is self-contained.
>>
>> The real question is, why would you need to change the text on the second >> page that will not be displayed during the current page request?
>>
>> "dana lees" <da***@idc.ac.il> wrote in message
>> news:ut****************@TK2MSFTNGP14.phx.gbl...
>> > Hello,
>> >
>> > I am developing a c# asp.net application. I have 2 forms.
>> >
>> > In the first webform ('header') i have a label.
>> > I want to reference that label from a different form ('user'), in order > to
>> > change its' text.
>> >
>> > How can i do that?
>> >
>> > Thank you,
>> > Dana
>> >
>> >
>>
>>
>
>



Nov 28 '05 #6
"Header" is a webform in which i want to include a user control, called
"numUsers".

The control i have created is called: "numUsers.ascx"

In order to user it in "Header.aspx", i have added the following code:

<%@ Register TagPrefix="uc1" TagName="numUsers" Src="numUsers.ascx" %>
<uc1:numUsers id="NumUsers1" runat="server"></uc1:numUsers>

In order to call setLabel() function in header.aspx.cs file, i have used:

numUsers ctrl = new numUsers();
ctrl = (numUsers)Page.FindControl("NumUsers1");
ctrl.setLabel("dana");

When debugging, i see that i do enter setLabel() function and set the label
to "dana" but then i enter Page_Load and the label is empty again.

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Okay, I am confused. What is the header? Is is a user control or a page in an iframe or what?

Pages are always reloaded when a request is made to the server. Not sure
what you mean by "reload header every time".
"dana lees" <da***@idc.ac.il> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
So i have to reload header every time i add/delete a user?
How do i reload it from a different form?

"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Such information should be saved in an application variable or in an
external file or database that will be read when the header loads and is displayed.

"dana lees" <da***@idc.ac.il> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
> On 'header' i have a label that shows the number of current users in
> the
> system.
> On 'User.aspx' i can add or delete a user and then i would like to

refresh
> the label on the first page because the number of users on it is no

longer
> valid...
>
> "Peter Rilling" <pe***@nospam.rilling.net> wrote in message
> news:%2******************@tk2msftngp13.phx.gbl...
>> You cannot simply access other pages without actually transferring
>> control
>> to that second page. Each page is self-contained.
>>
>> The real question is, why would you need to change the text on the

second
>> page that will not be displayed during the current page request?
>>
>> "dana lees" <da***@idc.ac.il> wrote in message
>> news:ut****************@TK2MSFTNGP14.phx.gbl...
>> > Hello,
>> >
>> > I am developing a c# asp.net application. I have 2 forms.
>> >
>> > In the first webform ('header') i have a label.
>> > I want to reference that label from a different form ('user'), in

order
> to
>> > change its' text.
>> >
>> > How can i do that?
>> >
>> > Thank you,
>> > Dana
>> >
>> >
>>
>>
>
>



Nov 29 '05 #7

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

Similar topics

3
by: Itai | last post by:
I have an aspx file named index.aspx which contains two ‘form' sections, one that has the runat=server attribute (e.g From1) and one which is a regular HTML form (e.g SignInForm). I am trying...
2
by: Chris Kettenbach | last post by:
Good Morning, I have a user control I dynamically load in the page_init event into a asp:placeholder control. This page also has another placeholder I would like to dynamically load controls into...
6
by: Shawn | last post by:
Any ideas how I can have a button click on one open page force a postback on a different page.
3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
2
by: Otto Wyss | last post by:
On a page of mine a user might submit data several time, which adds an entry to the history each time (similar as http://www.google.com/trends?q=iPod%2C+iPhone&ctab=0&geo=all&date=all). Yet later...
1
by: bb nicole | last post by:
Below is my interface for resume which need to post into database... I have did it all in one page and it already can send into database which the table name resume... But my letturer now want me...
5
by: Simon Benson | last post by:
Probably a fairly simple problem but one that's been plaguing me for a couple of days... can anyone help? I have a classic ASP page with a number of text boxes which are updatable. For...
8
by: wish | last post by:
Dear all, I would to ask that why the user always faced the different page when user click the back button instead back to page2.php but it go to page5.php..I remember in asp, we use the...
2
by: chainfire316 | last post by:
Hi, I am trying to find a script that automatically updates and lets my viewers know when a page was last updated but I want it to display on a different page then the one that is updating. Can...
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: 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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.