By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,925 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

Adding Blanks Lines Inside a Webform

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.