473,785 Members | 2,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I need some help with this

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 HtmlGenericCont rol
Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
gc.Attributes.A dd("id", "errorList" )

' Set its InnerHtml to the error list.
gc.InnerHtml = sb.ToString()

' Add it to the PlaceHolder on the page.
placehandler.Co ntrols.Add(gc)
Thanks
Nov 19 '05 #1
5 1388
The only problem I see is that \n gets outputted. instead try using
System.Environm ent.NewLine, ala:

sb.Append("<ul> ")
sb.Append(Syste m.Environment.N ewLine)

....

For Each serror In errors
sb.Append("<li> " + serror + "</li>")
sb.Append(Syste m.Environment.N ewLine)
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***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.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 HtmlGenericCont rol
Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
gc.Attributes.A dd("id", "errorList" )

' Set its InnerHtml to the error list.
gc.InnerHtml = sb.ToString()

' Add it to the PlaceHolder on the page.
placehandler.Co ntrols.Add(gc)
Thanks

Nov 19 '05 #2
<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***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.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 HtmlGenericCont rol
Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
gc.Attributes.A dd("id", "errorList" )

' Set its InnerHtml to the error list.
gc.InnerHtml = sb.ToString()

' Add it to the PlaceHolder on the page.
placehandler.Co ntrols.Add(gc)
Thanks

Nov 19 '05 #3
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***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.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 HtmlGenericCont rol
Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
gc.Attributes.A dd("id", "errorList" )

' Set its InnerHtml to the error list.
gc.InnerHtml = sb.ToString()

' Add it to the PlaceHolder on the page.
placehandler.Co ntrols.Add(gc)
Thanks


Nov 19 '05 #4
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.New Line). 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***@discussi ons.microsoft.c om> wrote in message
news:6B******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.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 HtmlGenericCont rol
> Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
> gc.Attributes.A dd("id", "errorList" )
>
> ' Set its InnerHtml to the error list.
> gc.InnerHtml = sb.ToString()
>
> ' Add it to the PlaceHolder on the page.
> placehandler.Co ntrols.Add(gc)
>
>
> Thanks


Nov 19 '05 #5
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.New Line). 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***@discussi ons.microsoft.c om> wrote in message
news:6B******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c om> wrote in message
news:3D******** *************** ***********@mic rosoft.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 HtmlGenericCont rol
> Dim gc As HtmlGenericCont rol = New HtmlGenericCont rol("div")
> gc.Attributes.A dd("id", "errorList" )
>
> ' Set its InnerHtml to the error list.
> gc.InnerHtml = sb.ToString()
>
> ' Add it to the PlaceHolder on the page.
> placehandler.Co ntrols.Add(gc)
>
>
> Thanks


Nov 19 '05 #6

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

Similar topics

4
2015
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). Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003
0
1840
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, all dont work "Re:" need help "Re:need help"
11
1946
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 NewsLeecher v3.0 Beta 7 * http://www.newsleecher.com/?usenet
6
7306
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.... #include <stdio.h> #include <stdlib.h>
1
1692
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 example i need to be able to find <a href="mailto:me@mysite.com">Click Here</a> and just get the mailto portion and then do a replace with an encoded email address. The replace isnt the problem just not sure how to make a reg ex that will search...
15
4644
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 communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
0
3963
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 Inbox Reply from Craig Somerford <uscos@2barter.net> hide details 10:25 pm (3 minutes ago)
3
4200
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 finish working, I will only have 2 shifts 1 or 2 . Shift one changes based on the location however any thing else is shift 2. The problem I am having is when someone signed in after midnight; I need to report his time under shift 2 for the...
2
1754
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, find it very hard to overcome the inertia and hence can't just get started. Besides, Maths problems are always a source of worries and nightmares to the majority of students. Hence most students need an academic mentor who can help them...
1
1734
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 someone who knows how to help a person without making them feel like they are a complete idiot can help me. I need to know how to code a nav/menu bar (or whatever you want to call it) in a css template so that it works in IE. It works in Firefox,...
0
9645
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10327
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10151
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8973
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6740
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3647
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.