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

Insert same information many times

Hi!

Heres something thats been bugging me but I don't seem to be able to
find an elegant way of solving the problem....

I'd like to have a small amount of dynamic text (its actually a string
sucked in from the appsettings section in the web.config) appear in
various locations on a webpage (NOT part of a recordset etc). In this
case its a brandname for the site.

So, I want to just intermingle the brand name in the pages text where
it suits. If I changed brand no probs I just change my config and the
whole site adjusts to suit.

I know of two ways to do it...

A. Use a lot of asp.net label or literal controls and then set each
one individually in the code behind. This just looks ugly and isn;t
the best to maintain.

B. Use an inline expression and call a function that returns the
brandname. A better solution but from what I know (it isn;t much!)
that starts to go back to old classic ASP although by just calling the
function the code is still isolated to the code behind...

I was thinking of a control collection or something that I can iterate
through. I guess my base question is whats the best way to perform
the task at hand!

Sorry about the waffling..... I love waffles.... :)

Cheers

Mar 2 '07 #1
7 812

"sfxpete" <sf******@hotmail.comwrote in message
news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.
Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Mar 2 '07 #2
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #3
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #4
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #5
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #6
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #7
On Mar 2, 2:26 am, "1388-2/HB" <1...@1.netwrote:
"sfxpete" <sfx_p...@hotmail.comwrote in message

news:11**********************@n33g2000cwc.googlegr oups.com...
I was thinking of a control collection or something that I can iterate
through.

Sounds like a good excuse to play with custom controls.

One way to tackle your problem is to make a custom Label control that
initializes it's text from the web.config file automatically. Then, instead
of inserting regular, blank Labels and iterating thru them, insert your
custom Labels and you're done.

On the iteration front you've got Page.Controls and Page.FindControl at your
disposal to find just about any control you add to a page.
Thanks for the help, like the custom control idea. Never even occured
to me to do it that way! Just out of interest can anybody give me a
good reason not to use an inline expression in this instance otherwise
I'm forced to put in a label wether it is a custom one or one thats
comes with asp.net and that means the hassle of giving them nice names
for everyone and on every page. In this case that could mean me
inserting over 100-125 controls and having to name them nicely! Or is
this just a side effect of the all the advantages I will have from
using them? It must be noted that I'm fairly new to asp.net and come
from a asp background.

Cheers guys (and girls!)

Mar 2 '07 #8

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

Similar topics

18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: Nothing | last post by:
I have a form that a person enters some information on. They then clicka button that triggers VBA to perfom a SQL INSERT INTO query. One of the fields auto assignes the current date. Another...
3
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode...
0
by: crypto_solid via AccessMonster.com | last post by:
I have been using a SQL database with a VB5 frontend for about 5 years. Works well. Unfortunately I don't have access to the source code. I was tasked with implementing a "job entry" application...
10
by: Mike | last post by:
I know this sounds strange but I am at a loss. I am calling a simple funtion that opens a connection to a SQL Server 2000 database and executes an Insert Statement. private void...
11
by: Sezai YILMAZ | last post by:
Hello I need high throughput while inserting into PostgreSQL. Because of that I did some PostgreSQL insert performance tests. ------------------------------------------------------------ --...
3
by: ctrap | last post by:
Hi Everyone, Here's my situation: I'm making a website for an employment agency, there is a page where potential employees can visit and "pre-register". When the submit button is hit the...
9
by: =?ISO-8859-1?B?UOlw6g==?= | last post by:
I have a page that inserts these values in the table... $fundo_nome = $_POST; $fundo_link = $_POST; $fundo_activo = $_POST; $sql = sprintf("INSERT INTO relatorio_fundo(fundo_nome,...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...
0
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...

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.