473,320 Members | 1,946 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,320 software developers and data experts.

Is it possible to set the Text property of more than one literal in one go?

Hello,

Suppose I have a page that has several literal controls and I want to be
able to set the Text property of these controls all to the same value.
Is there a simple way of doing this?

The example in hand is where I want to set both the <title> tag and a
<h1> tag on the body of the page to show the name of the product being
displayed. I know I can do this in two lines, but I was wondering if
there is a way doing it in one go, so if I need to use the product name
elsewhere, I can just add another control and not need to remember to go
back and add an extra line to set the Text.

Any ideas? TIA

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #1
4 1268
Alan Silver wrote:
Hello,

Suppose I have a page that has several literal controls and I want to be
able to set the Text property of these controls all to the same value.
Is there a simple way of doing this?

The example in hand is where I want to set both the <title> tag and a
<h1> tag on the body of the page to show the name of the product being
displayed. I know I can do this in two lines, but I was wondering if
there is a way doing it in one go, so if I need to use the product name
elsewhere, I can just add another control and not need to remember to go
back and add an extra line to set the Text.

Any ideas? TIA


use a variable to hold it... but in the end its still multiple lines

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #2
>> Hello,
Suppose I have a page that has several literal controls and I want
to be able to set the Text property of these controls all to the same
value. Is there a simple way of doing this?
The example in hand is where I want to set both the <title> tag and
a <h1> tag on the body of the page to show the name of the product
being displayed. I know I can do this in two lines, but I was
wondering if there is a way doing it in one go, so if I need to use
the product name elsewhere, I can just add another control and not
need to remember to go back and add an extra line to set the Text.
Any ideas? TIA


use a variable to hold it... but in the end its still multiple lines


OK thanks, it was just an idea.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #3
On Wed, 29 Jun 2005 18:59:09 +0100, Alan Silver wrote:
Hello,

Suppose I have a page that has several literal controls and I want to be
able to set the Text property of these controls all to the same value.
Is there a simple way of doing this?

The example in hand is where I want to set both the <title> tag and a
<h1> tag on the body of the page to show the name of the product being
displayed. I know I can do this in two lines, but I was wondering if
there is a way doing it in one go, so if I need to use the product name
elsewhere, I can just add another control and not need to remember to go
back and add an extra line to set the Text.

Any ideas? TIA

What about overriding the Render method, catching the output of the base
class, then using string replace to change the stuff.

Or
Use <%=something%> at the appropriate places and give a values to
something

Nov 19 '05 #4
>> Suppose I have a page that has several literal controls and I want to be
able to set the Text property of these controls all to the same value.
Is there a simple way of doing this?

The example in hand is where I want to set both the <title> tag and a
<h1> tag on the body of the page to show the name of the product being
displayed. I know I can do this in two lines, but I was wondering if
there is a way doing it in one go, so if I need to use the product name
elsewhere, I can just add another control and not need to remember to go
back and add an extra line to set the Text.

Any ideas? TIAWhat about overriding the Render method, catching the output of the base
class, then using string replace to change the stuff.


Ulp, not sure I'd know how to do that!! It sounds a bit beyond my
limited capabilities at the moment.

Where would I find more info about how this is done? Maybe I'll look and
see.
Or
Use <%=something%> at the appropriate places and give a values to
something


Funny, as an ex-Classic ASP programmer, I've studiously avoided using
<%=%> as it sounds like the "old" way of doing things. It never even
crossed my mind to do it that way!! I guess I'm trying to get my head
into the OOP way of looking at web pages, and this doesn't really fit
with that.
Thanks for the reply.

--
Alan Silver
(anything added below this line is nothing to do with me)
Nov 19 '05 #5

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

Similar topics

0
by: NancyASAP | last post by:
In case anyone hasn't seen this problem, just sharing the info.... I created a dotnet 1.1 page with a literal control. I used a streamreader to open a text file to fill the control. I filled the...
1
by: Epson Barnett | last post by:
Hi, I'm new to C# and I'd like to be able to reference a field of an object using a variable instead of literal text. In the PHP scripting language, you can create a variable: $var = "name";...
1
by: Bob Voss | last post by:
If I add a hidden input control to a tablecell and then set the cell's text property, the hidden control is not output. If I set the text first, then the hidden control is output but the text is...
0
by: NeilG | last post by:
Hi, I have an ASPX page with a literal control on the page. The page structure is like a frameset (but I dont use frames, this is just to give you an idea of how it looks) with records down the...
4
by: Ed West | last post by:
Hello Can I put generic HTML Text in a Placeholder, or does it need to be a server control? If I can't, how can I put dynamically put in some text in a template? ie, in the .ascx file ...
14
by: emailscotta | last post by:
Some of the object properties in the Dojo Toolkit are set to objects but they are using syntax like this: object.property = new function() { this.property = someValue; this.property =...
4
by: Neo Geshel | last post by:
Just moved to C# from VB.NET, frustrated to hell and back by inability to get much-copied (from about 20+ different resources) literal example to work. Master Page content: <meta...
45
by: Zytan | last post by:
This returns the following error: "Cannot modify the return value of 'System.Collections.Generic.List<MyStruct>.this' because it is not a variable" and I have no idea why! Do lists return copies...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.