server controls and Page Methods

server controls and Page Methods

am 17.01.2008 17:13:13 von jasonmwilkerson

Can you access properties (Text, Visible, etc...) on server controls
(i.e. TextBox, Label, etc...) from javascript? I am trying to toggle
the visibility of a Label clientside.



OnClientClick="toggle();return false;" />

Is this possible?
Thanks!
Jason

Re: server controls and Page Methods

am 17.01.2008 17:25:48 von grava

wrote in message
news:26339b3d-0fe8-49ba-a47c-67ea4c3012e7@e25g2000prg.google groups.com...
> Can you access properties (Text, Visible, etc...) on server controls
> (i.e. TextBox, Label, etc...) from javascript? I am trying to toggle
> the visibility of a Label clientside.
>
>
>
> > OnClientClick="toggle();return false;" />
>
> Is this possible?
> Thanks!
> Jason

You've got Dom Properties for that:

var label = $get('<%=this.lblMessage.ClientID %>');
if (label.style) {
label.style.display = "hidden";
}
}

Or you can prototype all the properties of Label (for example) and wrap all
methods ... I think it's a suicide !

HTH


--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava

Re: server controls and Page Methods

am 17.01.2008 17:45:13 von Scott Roberts

wrote in message
news:26339b3d-0fe8-49ba-a47c-67ea4c3012e7@e25g2000prg.google groups.com...
> Can you access properties (Text, Visible, etc...) on server controls
> (i.e. TextBox, Label, etc...) from javascript? I am trying to toggle
> the visibility of a Label clientside.
>
>
>
> > OnClientClick="toggle();return false;" />
>
> Is this possible?
> Thanks!
> Jason

The server controls themselves cannot be manipulated via javascript, but the
HTML generated by the server controls can. I believe that a Label renders as
a element, which may or may not contain the functionality you desire.
Personally, I would wrap the label in a

element and then toggle the
visibility of the
.

Re: server controls and Page Methods

am 17.01.2008 18:16:15 von grava

"Scott Roberts" wrote in
message news:OMHEUhSWIHA.4904@TK2MSFTNGP06.phx.gbl...
>
> wrote in message
> news:26339b3d-0fe8-49ba-a47c-67ea4c3012e7@e25g2000prg.google groups.com...
>> Can you access properties (Text, Visible, etc...) on server controls
>> (i.e. TextBox, Label, etc...) from javascript? I am trying to toggle
>> the visibility of a Label clientside.
>>
>>
>>
>> >> OnClientClick="toggle();return false;" />
>>
>> Is this possible?
>> Thanks!
>> Jason
>
> The server controls themselves cannot be manipulated via javascript, but
> the HTML generated by the server controls can. I believe that a Label
> renders as a element, which may or may not contain the
> functionality you desire. Personally, I would wrap the label in a


> element and then toggle the visibility of the
.

Ops ... yes .. you've got to wrap into a div to set the "display" style !

Sorry.


--
Gianluca Gravina
http://blogs.ugidotnet.org/thinkingingrava