I have an error panel that is subbed in to a page if an error goes wrong to gracefully handle and display errors. Currently, I am just appending the error messages to a string and pushing that to a label. If you have multiple errors, this gets messy. Therefore, I’d like to push each error to a list item in a bulleted, unordered list.
How can I dynamically generate, from a vb codebehind file, new list items inside of an undordered list element?
Why not use a
BulletedListcontrol? This control will render an unordered list to the client.You can then add list items programmatically from code behind like this.
You can also accomplish this by adding
runat='server'to reference theULtag server side.Then in the code behind use the
InnerHtmlproperty to programmatically addLItags to the contents within the opening and closingULtags.