If I have aspx code like:
< asp:label Text='<%# GetData() %>'>< /asp:label>
Is there some way in my GetData() method that I can get a handle to this
Label control, and set other properties apart from Text, too'
That way a single db addess could set text, color, visibility etc.
Passing 'this' just returns the asp:Page control :(
Thanks,
John
PS. I may have asked this before, but can't find the message anywhere!"John" <jsparrowNOSPAM@.ecclesdeletethiscollege.ac.uk> wrote in message
news:u85VLOkcEHA.1896@.TK2MSFTNGP10.phx.gbl...
> If I have aspx code like:
> < asp:label Text='<%# GetData() %>'>< /asp:label>
> Is there some way in my GetData() method that I can get a handle to this
> Label control, and set other properties apart from Text, too'
It wouldn't be a good idea for GetData to know what control it's binding to,
so it wouldn't be a good idea for it to set any properties at all, much less
to set more than one property.
What about :
<asp:Label Text='<%# GetData()["Text"] %>' ForeColor='<%# GetData["Color"]
%>' />
--
John Saunders
johnwsaundersiii at hotmail
John,
Yes you can do this, and it is perfectly ok.
Add DataBinding event to your Label control and make GetData () the event
handler. It will get parameter "sender" which is the reference to the
control originated the event. In this way you can use the same GetData()
method for many controls and access as many control properties as you wish.
Eliyahu
The trick
"John" <jsparrowNOSPAM@.ecclesdeletethiscollege.ac.uk> wrote in message
news:u85VLOkcEHA.1896@.TK2MSFTNGP10.phx.gbl...
> If I have aspx code like:
> < asp:label Text='<%# GetData() %>'>< /asp:label>
> Is there some way in my GetData() method that I can get a handle to this
> Label control, and set other properties apart from Text, too'
> That way a single db addess could set text, color, visibility etc.
> Passing 'this' just returns the asp:Page control :(
> Thanks,
> John
> PS. I may have asked this before, but can't find the message anywhere!
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment