drpcken
Posts: 60
|
Posted: 10/25/2004, 3:02 PM |
|
I have a header thats listed in all my pages. I have a label in that header that I hide before show and only show under certian circumstances.
My question is, can I control the visiblity of the label from the page that the header is included in?
|
|
|
Tuong Do
|
Posted: 10/25/2004, 6:00 PM |
|
Hi drpcken,
Yes you can control the visibility with the page
For example your incluede page is called myheader
And there is a label called label1 with that includable page
Then in the page that the header is included
In the On Initilised View event of the page
FindControl("myheader").FindControl("label1").visible = false
"drpcken" <drpcken@forum.codecharge> wrote in message
news:8417d77eac8c04@news.codecharge.com...
>I have a header thats listed in all my pages. I have a label in that
>header
> that I hide before show and only show under certian circumstances.
>
> My question is, can I control the visiblity of the label from the page
> that the
> header is included in?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
drpcken
Posts: 60
|
Posted: 10/26/2004, 6:59 AM |
|
Hey thanks for the answer. What you said makes perfect sense, but when I try and build, it tells me 'text' is not a member of 'System.Web.UI.Control'
The visible property seems to work, but I wanted to change the text as well, I think I have a way around, but I was wondering why the text property wouldn't work if the visible property would not.
Thanks!!
|
|
|
Tuong Do
|
Posted: 10/26/2004, 9:12 PM |
|
Hi drpcken,
To pass the compiler you have to declare the variable before you can assign
the text attribute
Dim alabel = FindControl("myheader").FindControl("label1")
alabel.text = "This is a test"
However, since the value of label1 is re populated in the myheader which is
happen after the above code, so the value of label1 is unchange
To get around the problem, what I normally do is
In the myheader page set the value of the label1 to a session variable
<code>
label1.text = Session("label1")
Session("label1") = nothing
</code>
In the initialize view event of the page that the header is included in,
set session("label1") to something
<code>
Session("label1") = "this is a label"
</code>
"drpcken" <drpcken@forum.codecharge> wrote in message
news:8417d77eac8c04@news.codecharge.com...
>I have a header thats listed in all my pages. I have a label in that
>header
> that I hide before show and only show under certian circumstances.
>
> My question is, can I control the visiblity of the label from the page
> that the
> header is included in?
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|