<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UnnumberedList.aspx.cs"
Inherits="Experimentation.Pages.UnnumberedList" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.bulletList
{
list-style-type: none;
}
.bulletList li
{
float: left;
margin-left: 10px;
}
.bulletList li.firstInRow
{
clear: both;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:BulletedList ID="BulletedList1" runat="server" CssClass="bulletList">
</asp:BulletedList>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Experimentation.Pages
{
public partial class UnnumberedList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
for (int i = 0; i < 9; i++)
{
ListItem li = new ListItem("id" + (i + 1).ToString());
if (i % 3 == 0)
li.Attributes.Add("class", "firstInRow");
BulletedList1.Items.Add(li);
}
}
}
}
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Open in new window