473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Inserting Page variables into control's Text attribute in an aspx file

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 %>
amongst the other text.

How can I achieve this in an aspx file, or do I have to set this
property in the code behind file?

Thanks,

Paul

May 30 '06 #1
1 2136
I am not sure there is a way to combine variables with static text in the
*.aspx file for the Text property. I would suggest setting the Text property
in your code (probably immediately after you set the property). There might
be a way to do what you want using the (DataBindings) property (or whatever
the correct term for that box that you see above the (ID) property is, I'm
not sure if it is technically a property), but I have never used databinding
with anything other than databases and different collection types for
properties in controls that contain lists (such as DataList, DropDownList,
CheckBoxList, etc.), so I don't really know. Good Luck!
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

<pa*********@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
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 %>
amongst the other text.

How can I achieve this in an aspx file, or do I have to set this
property in the code behind file?

Thanks,

Paul

May 30 '06 #2

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

Similar topics

6
by: anon | last post by:
Post Forwarding question...... For this control below, <asp:Button runat="server" PostTargetUrl="page2.aspx" /> The Attribute: PostTargetUrl="page2.aspx" Is this PostTargetUrl Attribute...
4
by: Ben R. | last post by:
Between ClassName and Inherits, which attribute is set to specify the class that a page uses? I would think that would be inherits. Further, the description for ClassName is: Specifies the class...
6
by: Mary Kerrigan | last post by:
I have a user control (menu) with a data list: <asp:DataList id="MyList" runat="server"> <ItemTemplate> <asp:hyperlink cssclass="MenuUnselected" id="myLink1" Text='<%#...
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
2
by: rjack | last post by:
I'm using VS 2005 Beta 2. In VS 2003, the Page directive in an aspx page has Language and CodeBehind attributes. You can have the language be different than the code behind file language. For...
1
by: Alan Silver | last post by:
Hello, I am just experimenting with master pages, and am trying to add a content placeholder in the <head> section, so that individual pages can set their own page title and meta tags. The...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
3
by: premprakashbhati | last post by:
hi, good evening.. i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button() here is the code ...its work fine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.