Hi,
What is wrong with this code? I can't figure this out. Its suppose to display
..a bunch
..of errors
on my page. I am stuck for over 4 hrs now an this crap. Please assist.
This is on form load
Dim str As String = "a bunch|of errors"
Dim errors() As String = str.Split("|")
Dim sb As StringBuilder = New StringBuilder
' HTML code for a bulleted list
sb.Append("<ul>\n")
' Append each error to the bulleted list
Dim serror As String
For Each serror In errors
sb.Append("<li>" + serror + "</li>\n")
Next
sb.Append("</ul>")
' Create a <div> tag using an HtmlGenericControl
Dim gc As HtmlGenericControl = New HtmlGenericControl("div")
gc.Attributes.Add("id", "errorList")
' Set its InnerHtml to the error list.
gc.InnerHtml = sb.ToString()
' Add it to the PlaceHolder on the page.
placehandler.Controls.Add(gc)
Thanks 5 1368
The only problem I see is that \n gets outputted. instead try using
System.Environment.NewLine, ala:
sb.Append("<ul>")
sb.Append(System.Environment.NewLine)
....
For Each serror In errors
sb.Append("<li>" + serror + "</li>")
sb.Append(System.Environment.NewLine)
Next
otherwise everything seems fine...
You might consider using a repeater for this type of stuff...
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com... Hi, What is wrong with this code? I can't figure this out. Its suppose to display
.a bunch .of errors
on my page. I am stuck for over 4 hrs now an this crap. Please assist.
This is on form load
Dim str As String = "a bunch|of errors" Dim errors() As String = str.Split("|") Dim sb As StringBuilder = New StringBuilder
' HTML code for a bulleted list sb.Append("<ul>\n")
' Append each error to the bulleted list Dim serror As String
For Each serror In errors sb.Append("<li>" + serror + "</li>\n") Next
sb.Append("</ul>")
' Create a <div> tag using an HtmlGenericControl Dim gc As HtmlGenericControl = New HtmlGenericControl("div") gc.Attributes.Add("id", "errorList")
' Set its InnerHtml to the error list. gc.InnerHtml = sb.ToString()
' Add it to the PlaceHolder on the page. placehandler.Controls.Add(gc)
Thanks
<BR> is the recognized newline tag in HTML. \n will show
in how the code looks in Page Source but will not be
reflected in how the html looks to the user.
--
2004 and 2005 Microsoft MVP C#
Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com... Hi, What is wrong with this code? I can't figure this out. Its suppose to display
.a bunch .of errors
on my page. I am stuck for over 4 hrs now an this crap. Please assist.
This is on form load
Dim str As String = "a bunch|of errors" Dim errors() As String = str.Split("|") Dim sb As StringBuilder = New StringBuilder
' HTML code for a bulleted list sb.Append("<ul>\n")
' Append each error to the bulleted list Dim serror As String
For Each serror In errors sb.Append("<li>" + serror + "</li>\n") Next
sb.Append("</ul>")
' Create a <div> tag using an HtmlGenericControl Dim gc As HtmlGenericControl = New HtmlGenericControl("div") gc.Attributes.Add("id", "errorList")
' Set its InnerHtml to the error list. gc.InnerHtml = sb.ToString()
' Add it to the PlaceHolder on the page. placehandler.Controls.Add(gc)
Thanks
That did't work. Any other ideas?
"Robbe Morris [C# MVP]" wrote: <BR> is the recognized newline tag in HTML. \n will show in how the code looks in Page Source but will not be reflected in how the html looks to the user.
-- 2004 and 2005 Microsoft MVP C# Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx "Chris" <Ch***@discussions.microsoft.com> wrote in message news:3D**********************************@microsof t.com... Hi, What is wrong with this code? I can't figure this out. Its suppose to display
.a bunch .of errors
on my page. I am stuck for over 4 hrs now an this crap. Please assist.
This is on form load
Dim str As String = "a bunch|of errors" Dim errors() As String = str.Split("|") Dim sb As StringBuilder = New StringBuilder
' HTML code for a bulleted list sb.Append("<ul>\n")
' Append each error to the bulleted list Dim serror As String
For Each serror In errors sb.Append("<li>" + serror + "</li>\n") Next
sb.Append("</ul>")
' Create a <div> tag using an HtmlGenericControl Dim gc As HtmlGenericControl = New HtmlGenericControl("div") gc.Attributes.Add("id", "errorList")
' Set its InnerHtml to the error list. gc.InnerHtml = sb.ToString()
' Add it to the PlaceHolder on the page. placehandler.Controls.Add(gc)
Thanks
you weren't very clear, to me atleast, what exactly is wrong. I figured you
wanted to use \n to display a new line in the view source (hence why I
suggested Environment.NewLine). Since you are wrapping your strings in list
items, they'll automatically appear on a new line. If you need extra
spacing between listitems, you should use css...
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:6B**********************************@microsof t.com... That did't work. Any other ideas?
"Robbe Morris [C# MVP]" wrote:
<BR> is the recognized newline tag in HTML. \n will show in how the code looks in Page Source but will not be reflected in how the html looks to the user.
-- 2004 and 2005 Microsoft MVP C# Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx "Chris" <Ch***@discussions.microsoft.com> wrote in message news:3D**********************************@microsof t.com... > Hi, > What is wrong with this code? I can't figure this out. Its suppose to > display > > .a bunch > .of errors > > on my page. I am stuck for over 4 hrs now an this crap. Please assist. > > This is on form load > > Dim str As String = "a bunch|of errors" > Dim errors() As String = str.Split("|") > Dim sb As StringBuilder = New StringBuilder > > ' HTML code for a bulleted list > sb.Append("<ul>\n") > > ' Append each error to the bulleted list > Dim serror As String > > For Each serror In errors > sb.Append("<li>" + serror + "</li>\n") > Next > > sb.Append("</ul>") > > ' Create a <div> tag using an HtmlGenericControl > Dim gc As HtmlGenericControl = New HtmlGenericControl("div") > gc.Attributes.Add("id", "errorList") > > ' Set its InnerHtml to the error list. > gc.InnerHtml = sb.ToString() > > ' Add it to the PlaceHolder on the page. > placehandler.Controls.Add(gc) > > > Thanks
Thanks
"Karl Seguin" wrote: you weren't very clear, to me atleast, what exactly is wrong. I figured you wanted to use \n to display a new line in the view source (hence why I suggested Environment.NewLine). Since you are wrapping your strings in list items, they'll automatically appear on a new line. If you need extra spacing between listitems, you should use css...
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/ - New and Improved (yes, the popup is annoying) http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!)
"Chris" <Ch***@discussions.microsoft.com> wrote in message news:6B**********************************@microsof t.com... That did't work. Any other ideas?
"Robbe Morris [C# MVP]" wrote:
<BR> is the recognized newline tag in HTML. \n will show in how the code looks in Page Source but will not be reflected in how the html looks to the user.
-- 2004 and 2005 Microsoft MVP C# Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx "Chris" <Ch***@discussions.microsoft.com> wrote in message news:3D**********************************@microsof t.com... > Hi, > What is wrong with this code? I can't figure this out. Its suppose to > display > > .a bunch > .of errors > > on my page. I am stuck for over 4 hrs now an this crap. Please assist. > > This is on form load > > Dim str As String = "a bunch|of errors" > Dim errors() As String = str.Split("|") > Dim sb As StringBuilder = New StringBuilder > > ' HTML code for a bulleted list > sb.Append("<ul>\n") > > ' Append each error to the bulleted list > Dim serror As String > > For Each serror In errors > sb.Append("<li>" + serror + "</li>\n") > Next > > sb.Append("</ul>") > > ' Create a <div> tag using an HtmlGenericControl > Dim gc As HtmlGenericControl = New HtmlGenericControl("div") > gc.Attributes.Add("id", "errorList") > > ' Set its InnerHtml to the error list. > gc.InnerHtml = sb.ToString() > > ' Add it to the PlaceHolder on the page. > placehandler.Controls.Add(gc) > > > Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: snakeking |
last post by:
Hi all,
I need to learn enough php to make a 2 page website that looks nice...HELP!
SK
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com)....
|
by: xunling |
last post by:
i have a question about answering ..... this topic is "need help"
what do i have to write at te topic line, !after i have klicked the
"answer message" button
ive tried many possibilities,...
|
by: blah |
last post by:
Need python Pro at newtopython@googlegroups.com , if u wanna help, plz
reply to that address. We are python beginners. need a real good
Python Programmer for Help. TIA!!
--
* Posted with...
|
by: Rafael |
last post by:
Hi Everyone,
I need some help with my calculator program. I need my program to
do 2 arguments and a 3rd, but the 3rd with different operators. Any
help would be great.
Here is my code....
...
|
by: Showjumper |
last post by:
I need a regulr expression that cn be used to find <a> tags with the href
attribute set to mailto:. I need to be to search out all the email addresses
in the text of the pages in a website. So for...
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to...
|
by: U S Contractors Offering Service A Non-profit |
last post by:
Brilliant technology helping those most in need Inbox
Reply
U S Contractors Offering Service A Non-profit
show details
10:37 pm (1 hour ago)
Brilliant technology helping those most in need ...
|
by: Amy Smith |
last post by:
Hello there,
I am having a small problem which been challenging me for few days and
need help or advice.
I am trying to calculate the day-shift for employees based on the time
they started and...
|
by: =?Utf-8?B?am9lb2ppaA==?= |
last post by:
Most students do not have enough time to do their homeworks, assignments,
college papers, etc alone. Also most of them, even though they know what to
do with respect to their writing assignment,...
|
by: jhaydon |
last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |