473,800 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp:Checkbox Text attribute-- how to do this?

Hi everyone,

This is a silly one I'm sure, but I'm having a whale of a time putting some
text into my asp checkbox. Here's what I'd like to do:

<asp:CheckBox runat="server" Text='<%#DataBi nder.Eval(Conta iner.DataItem,
"OptionLabel")% > Fields' ID="chkDBFields "/>

....unfortunate ly, it doesn't work. The DataBinder text is evaluated
literally, so all I get on-screen is the word "Fields". And whenever I try
playing with the quotes I receive various syntax errors. Could someone show
me how to get this to work, so that I have my data-bound field and the word
"Fields" appended to it in the checkbox text? Thanks very much.
Nov 19 '05 #1
3 3616
Hello,
You may want to try:

<asp:CheckBox runat="server" Text='<%#DataBi nder.Eval(Conta iner.DataItem,
"OptionLabe l") & "Fields" %>' ID="chkDBFields "/>

I have not tried this in a checkbox, but it has worked for me in textboxes.

Regards,
Cesar

"Jim Bancroft" wrote:
Hi everyone,

This is a silly one I'm sure, but I'm having a whale of a time putting some
text into my asp checkbox. Here's what I'd like to do:

<asp:CheckBox runat="server" Text='<%#DataBi nder.Eval(Conta iner.DataItem,
"OptionLabel")% > Fields' ID="chkDBFields "/>

....unfortunate ly, it doesn't work. The DataBinder text is evaluated
literally, so all I get on-screen is the word "Fields". And whenever I try
playing with the quotes I receive various syntax errors. Could someone show
me how to get this to work, so that I have my data-bound field and the word
"Fields" appended to it in the checkbox text? Thanks very much.

Nov 19 '05 #2
My experience that it will not work.The reason is that you have ranat
=server attribute.
You should use ItemDataBound event to write the text.
Shimon
"Jim Bancroft" <as******@nowhe re.com> wrote in message
news:%2******** *******@TK2MSFT NGP09.phx.gbl.. .
Hi everyone,

This is a silly one I'm sure, but I'm having a whale of a time putting
some text into my asp checkbox. Here's what I'd like to do:

<asp:CheckBox runat="server" Text='<%#DataBi nder.Eval(Conta iner.DataItem,
"OptionLabel")% > Fields' ID="chkDBFields "/>

...unfortunatel y, it doesn't work. The DataBinder text is evaluated
literally, so all I get on-screen is the word "Fields". And whenever I
try playing with the quotes I receive various syntax errors. Could
someone show me how to get this to work, so that I have my data-bound
field and the word "Fields" appended to it in the checkbox text? Thanks
very much.

Nov 19 '05 #3
Thank you, Cesar. What I wound up doing was this:

<asp:CheckBox runat="server"
Text=<%#Convert .ToString(DataB inder.Eval(Cont ainer.DataItem, "OptionLabe l"))
+ " Database Fields"/>

It's what worked for me. I hope someone can make use of it too.

-Jim
Nov 19 '05 #4

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

Similar topics

6
1547
by: sklett | last post by:
I'm curious... asp:Panel renderes a <div> tag, right? And you can have text in a div tag.... so why not have a Text property for the asp:panel control??
1
1661
by: BARTKO, Zoltan | last post by:
Hello folks, I have the following problem: I have a bunch of text files, I want to load them into a table where each file will be stored in one row. Question 1: Is there any way how to do this in psql? AFAIK the \copy command interprets \n as a new line and so I can't get it
1
1277
by: serge calderara | last post by:
Dear all, I have a datagrid which is bind to a databse table. One field of that table contains a filename. What I ma trying to do is to display the content of a cell to be an icon when the database field is not empty. In addition a direct link to the file will be done. Follow is my Datagrid structure for that column:
1
2155
by: paul.hester | last post by:
Hi all, I'm trying to display the a Page variable's value in the Text property of a CheckBox control in the aspx file: <asp:CheckBox ID="agreeTerms" Text="I agree to the <%# this.SiteName %> terms and conditions" runat="server" /> I can do this elsewhere on the page, outside of a control, but in the Text property it just renders the literal text: <%# this.SiteName %>
3
1701
by: Kevin Burton | last post by:
I have an XSD that is converted from a DTD that I am trying to clean up. There is a section in the XSD that looks like: <xs:element name="partnerID"> <xs:complexType mixed="true"> <xs:attribute name="name" type="xs:string"/> <xs:attribute name="roleType" type="xs:string"/> </xs:complexType> </xs:element>
9
8430
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
0
1407
by: K B | last post by:
Hi, I would like to show an image in the text position of radiobuttonlist listitems. Not from a dataset, just set in the html or code behind. Example (x = radio button) x Red light image x Yellow light image x Green light image
4
1714
by: jeddiki | last post by:
Hi, I am trying to harmonize my type face with my blog. this is what I have: http://www.expert-world.com/im/images/trash3.jpg Use see the USEFUL CONNECTIONS ?
2
1325
by: bigguyjoe | last post by:
I am using modx to create a site at www.mmwri.com. The navigation is dynamically generated by Wayfinder. I am trying to style the text with the navigation div. I can make it look fine in any Mac browser but the spacing overflows the navigation to a second line in Windows Browsers. Any input would be appreciated. Thanks! Here is the CSS: #navigation { background-color: white; width: 800px; display:block; height:40px; ...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10275
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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 we have to send another system
3
2945
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.