473,569 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2576
'you would create a <ol> tag like this
Dim ol As New HtmlGenericCont rol("ol")

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

'you can add it to list item like this
Dim li As New HtmlGenericCont rol("li")
li.InnerText = "some text"
li.Attributes.A dd("class", "listitemCs s")
ol.Controls.Add (li)

'then add it to a placeholder on your aspx page
PlaceHolder1.Co ntrols.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
1465
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 image: http://www.plankmeister.org.uk/new/box-model.png The red box is the containing object (p, div, span or whatever.) The blue is the image, and...
0
1379
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 receive notifications from the HTMLControl. In an attempt to support this, I added a private MessageWindow derived class to the control,...
2
3541
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
4832
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 through the codebehind? <tr id="trMyRow" runat="server" visible="false">...</tr> does not work. its kind of a pain to have to put a whole bunch...
0
936
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 one? usercontrol: <%@ Control Language="c#" AutoEventWireup="false" Codebehind="WebUserControl2.ascx.cs"...
4
2834
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 version. CIAO Michael
6
1516
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 boil down one baffling aspect into a nutshell I know about getElementById(' ') and it takes the literal id of a control, or a variable with that...
0
1600
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" ReadOnly="True" EnableViewState="False"></asp:textbox> <label class="col3">Rm Phone</label> <asp:textbox id="txtRmPhone" runat="server" cssclass="col4"...
5
1580
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 HtmlControl is good or bad ????) Private _Id As String = "myId"
0
7924
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. ...
0
8125
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...
1
7676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.