473,406 Members | 2,356 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,406 software developers and data experts.

Adding Blanks Lines Inside a Webform

Hi,

I am creating an ASP.NET site and have created a form which I have
been able to dynamically with listboxes, labels etc from a database -
using mainly form1.Controls.Add .....

Does anyone know how I can add blank lines to a form. If I use
response.write it writes to the body of the HTML and not inside the
form. I am sure it must be easy but it has got me stuck. I have tried
adding a label with vbcrlf inside it but the CRLF stays inside the
label and doesn't force a new line on the client side page.

I would like to be able to newlines from the code behind aspx.vb as
the number of them may change each time depending on other bits of
logic in the code.

Any help would be very much appreciated!

Thanks

Pete

Oct 25 '07 #1
1 1833
It sounds to me like you just need to add a <br/in your code. The best way
to do this when creating the page dynamically by use of the Add() method is
to create the following:

<asp:Literal runat="server" Mode="PassThrough" Text="<br/>"/>

You must use the Mode="PassThrough" or else ASP.NET will convert it to
&lt;br/&gt; (or something like that). The code to create the control would
be:

Dim brtag As New Literal()
brtag.Mode = LiteralMode.PassThrough
brtag.Text = "<br/>"

And then add it using the Add(brtag) just like you would add any other
control. In your code, this will show up as nothing more than "<br/>" (it
will not have an extra id attribute or anything else that is added to most
tags). When I write an application in which I have to dynamically add <br/>
tags, I write an extra subroutine, since you will probably be adding
multiple <br/tags when you create an entire page dynamically. Hopefully
this helps.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"CapRand" <pe********@hanson.bizwrote in message
news:11*********************@22g2000hsm.googlegrou ps.com...
Hi,

I am creating an ASP.NET site and have created a form which I have
been able to dynamically with listboxes, labels etc from a database -
using mainly form1.Controls.Add .....

Does anyone know how I can add blank lines to a form. If I use
response.write it writes to the body of the HTML and not inside the
form. I am sure it must be easy but it has got me stuck. I have tried
adding a label with vbcrlf inside it but the CRLF stays inside the
label and doesn't force a new line on the client side page.

I would like to be able to newlines from the code behind aspx.vb as
the number of them may change each time depending on other bits of
logic in the code.

Any help would be very much appreciated!

Thanks

Pete

Oct 28 '07 #2

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

Similar topics

10
by: Melissa Mussitsch | last post by:
I've done this before while creating a brand new table. But the code below is not working and I keep getting the error: "Internet Explorer cannot open the Internet site ..... Operation aborted" ...
2
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete...
2
by: John Hoge | last post by:
I have a regex "^\d{5}$" that does not allow blanks, but the RegularExpressionValidator does not fire for empty fields. Is there a way to make it do so? I would rather not include a separate...
6
by: cpnet | last post by:
I've authored a custom web component (a non-ui component kinda like a DataSet) and so far it's working. When my web component is added to the web form in the designer from the toolbox, the...
5
by: Xaviero | last post by:
I have a webform that contains a placeholder control that is filled with various usercontrols. I have an error/info message label on the webform (for interface clenliness). Sometimes the the...
3
by: DC Gringo | last post by:
I've got a web user control (a) inside a web user control (b) inside a webform (c). I need the webform to set a label control text value inside the inner of the two web user control. Inside my...
34
by: Registered User | last post by:
Hi experts, I'm trying to write a program that replaces two or more consecutive blanks in a string by a single blank. Here's what I did: #include <stdio.h> #include <string.h> #define MAX 80
4
by: John Dalberg | last post by:
I am looking at a problem which is preventing my code to get a reference to any asp control inside a div section which has a runat=server attribute. This can be reproduced in a simple test:...
4
by: eBob.com | last post by:
I have a RichTextBox in which I'd like blanks to appear different from nothing. Imagine a file which does not fill up the RTB. You can't tell how many, if any, blanks might follow the last...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...

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.