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

Control Reuse

Hi,

I'm working on a web control at the moment which creates a simple form
with some fields and some labels, all on one line.

The output is fine and everything is ok, however I want to control the
space between the controls with a spacer image. Since there are 4
controls I will need 4 spacer images at 5px wide each to create a nice
even gap between each control so it doesnt look too bunched up.

I've tried creating one image control:
Dim spacer as New Image
spacer.imageurlBLAHBLAHwidth etc

and then adding this to the form between each control
Me.Controls.Add(lblUname)
Me.Controls.Add(spacer)
Me.Controls.Add(txtUname)
Me.Controls.Add(spacer)
.......... etc

However when the control is rendered it only displays the image in in
the place where it was last added.

Now I'm sure your all going to say thats how its supposed to be, which
is fine, however I would like to know how you can reuse control (like
an image control) to appear several times without having to declare a
new one each time. I'm sure its just a syntax thing, I supposed I
could just output the HTML as in:
Output.Write("{0} {1} {2}","<H2>", "Hello World", "</H2>")

But I'm kind of curious if control reuse in this way is possible.
Nov 18 '05 #1
2 1154
You have a more serious problem on your hands, which, if you solve it, will
render your present problem moot. Using an Image Control to create a static
HTML space in a Server Control is a total waste of server-side resources.
Images controls are useful if you want to change anything about the image.
Otherwise, use static HTML images.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"GingerNinja" <gr*******@hotmail.com> wrote in message
news:71**************************@posting.google.c om...
Hi,

I'm working on a web control at the moment which creates a simple form
with some fields and some labels, all on one line.

The output is fine and everything is ok, however I want to control the
space between the controls with a spacer image. Since there are 4
controls I will need 4 spacer images at 5px wide each to create a nice
even gap between each control so it doesnt look too bunched up.

I've tried creating one image control:
Dim spacer as New Image
spacer.imageurlBLAHBLAHwidth etc

and then adding this to the form between each control
Me.Controls.Add(lblUname)
Me.Controls.Add(spacer)
Me.Controls.Add(txtUname)
Me.Controls.Add(spacer)
......... etc

However when the control is rendered it only displays the image in in
the place where it was last added.

Now I'm sure your all going to say thats how its supposed to be, which
is fine, however I would like to know how you can reuse control (like
an image control) to appear several times without having to declare a
new one each time. I'm sure its just a syntax thing, I supposed I
could just output the HTML as in:
Output.Write("{0} {1} {2}","<H2>", "Hello World", "</H2>")

But I'm kind of curious if control reuse in this way is possible.

Nov 18 '05 #2
Fair comment thanks for the input. I must admit I'm not supprised to
hear that, however it doesnt really answer my final question:
But I'm kind of curious if control reuse in this way is possible?


I dont mean to be rude, there maybe a situation where this is usefull,
it matters not really, heck I just want to satisfy my curiosity on this.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

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

Similar topics

1
by: Jim Christiano | last post by:
Everyone, In order to promote code reuse, I've setup a web control (.ascx) in a standalone vs.net project. I can then reference this project in any web application. The trick is to setup a...
5
by: Miguel Dias Moura | last post by:
Hello, i am trying to create a .css file with several styles and apply them to the calendar control so i can change the look of: 1. Text Type and Format (Bold, Underline, etc) 2. Background...
1
by: Jim Christiano | last post by:
Everyone, In order to promote code reuse, I've setup a web control (.ascx) in a standalone vs.net project. I can then reference this project in any web application. The trick is to setup a...
2
by: john | last post by:
Maybe I haven't had that "a-ha" moment yet, but I think the new approach to web projects is a step in the wrong direction. My main beef is that control over the assembly generation process has...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
0
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
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...

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.