473,499 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting multiple property values in one databind

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!
Nov 18 '05 #1
2 1345
"John" <js************@ecclesdeletethiscollege.ac.uk> wrote in message
news:u8**************@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
Nov 18 '05 #2
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" <js************@ecclesdeletethiscollege.ac.uk> wrote in message
news:u8**************@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!

Nov 18 '05 #3

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

Similar topics

6
1510
by: suzy | last post by:
hello, how can i have multiple datarepeaters on the same aspx page? i have tried something similar to this: <asp:repeater id="repeater1" runat="server"> <itemtemplate> <td>text</td>...
2
7379
by: Thomas Solh?j | last post by:
Hi all. I cant databind rtf values to the rtf property of a winform richtextbox control. Does something have a clue how this i done? Ive tried this without luck:...
9
2326
by: james.e.coleman | last post by:
Hello, I have created a custom dropdownlist that is used multiple times within a single page. When trying to set the values of the controls with the page in which they are being used, they all...
8
2249
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
0
932
by: WB | last post by:
Hi, I have a ListBox on a web page that allows user to select their favorite colors. They can select multiple colors by pressing the Ctrl or Shift button on the keyboard. Now when user come back...
1
1392
by: Waran | last post by:
How to bind Multiple results into a datagrid. For example Assume the values for dsCustCode.Tables(0).Rows.Count = 4,and the values are "'Val1','val2','val3','val4'" in the below loop In the...
2
1108
by: Martin Gregersen | last post by:
Hi Looking for a way to bind a readonly property on a textbox to a parameter, not having to cycle through all controls, but rather setting <textbox id="myTextbox" readonly="<%# SetReadOnly...
3
5473
by: oliviers | last post by:
Here is my scenario: I first create a base class with one property : public class MyControl inherits System.Web.UI.UserControl Public readonly property IsEditable() boolean Get Return False ...
1
3048
by: dhyder | last post by:
OK, like the title says my error is Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. I have looked into this a lot, but have not...
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.