By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,289 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

Referencing a control on a different page

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.