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

HTMLControl bafflement

Hi folks

I want to add a <ul> list with some <li> items in .net code behind on the fly

I was under the impression that you could instantiate any HTML control by
using the HTMLControl class with constructor parameters like so

HTMLControl("ul")

the purpose being that I could then program some of the attributes of the ul
or the li using logic....
please don't worry if this is the best way but how can I get an unordered
list written out in code rather than in declarative HTML

I don't want to use the Literal control class, because I want some
server-side programming here
Regards and many thanks in advance
CharlesA
Mar 9 '06 #1
1 2563
'you would create a <ol> tag like this
Dim ol As New HtmlGenericControl("ol")

'you manage its attributes like this
ol.Attributes.Add("type", "circle")

'you can add it to list item like this
Dim li As New HtmlGenericControl("li")
li.InnerText = "some text"
li.Attributes.Add("class", "listitemCss")
ol.Controls.Add(li)

'then add it to a placeholder on your aspx page
PlaceHolder1.Controls.Add(ol)

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"CharlesA" wrote:
Hi folks

I want to add a <ul> list with some <li> items in .net code behind on the fly

I was under the impression that you could instantiate any HTML control by
using the HTMLControl class with constructor parameters like so

HTMLControl("ul")

the purpose being that I could then program some of the attributes of the ul
or the li using logic....
please don't worry if this is the best way but how can I get an unordered
list written out in code rather than in declarative HTML

I don't want to use the Literal control class, because I want some
server-side programming here
Regards and many thanks in advance
CharlesA

Mar 9 '06 #2

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

Similar topics

0
by: The Plankmeister | last post by:
Hi... I have a question about a custom layout in CSS. I am trying to achieve a result where I have a inline container which contains an image and three command buttons layed out as in this...
0
by: Hutch | last post by:
I am looking for some thoughts on this. I have successfully gotten the HTMLControl to work using C#, and it is displaying HTML and receiving messages nicely. Unfortunately, I am not able to...
2
by: Jeff Johnson | last post by:
I'm dynamically generating HtmlImages that I want to wrap with an HtmlAnchor. How do I do this? JJ
5
by: Tim Mulholland | last post by:
If i have an HtmlControl for a table row such as: <tr id="trMyRow" runat="server">...</tr> is there any way to set this to be invisible by default through the HTML code, without having to go...
0
by: Jimmy | last post by:
Hi, I have a userobject with an htmlcontrol tb1 and server control tb1. When I try to refer to those controls from my webform only the asp control works. The question is how to refer to the html...
4
by: michael.schwarz | last post by:
Hello, is it possible to get a HtmlControl from a string including the HTML code in .NET 2.0? I was using the TemplateControl.ParseControl method in .NET 1.1, but this is not working in the new...
6
by: CharlesA | last post by:
Hi folks, I'm using ASP.net with Framework 1.1 and C# to go into my actual problem and fully explain would take more than any of us could take (me writing it, you reading it) however I can...
0
by: CharlesA | last post by:
Hi folks, I'm using ASP.net 1.1 with C# I've got this kind of thing going <div class="row"> <label class="col1">Rm Name</label> <asp:textbox id="txtRM" runat="server" cssclass="col2"...
5
by: zino | last post by:
my asp.net page need to display links (<a></a>) as tabs. I create a class that inherits from HtmlAnchor as: Public Class Tab Inherits System.Web.UI.HtmlControls.HtmlAnchor '(inheriting from...
0
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
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
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,...
0
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,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.