给你写了个小例子:
页面代码:
<head runat="server">
<title></title>
<style type="text/css">
.text_right
{
text-align:right;
}
.bg_all
{
width:270px;
background-color:#E2E2E2;
}
.bg_count
{
background-color:#8ACA13;
color:#8ACA13;
}
li
{
list-style:none;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="text_right"><%# Eval("Name")%></td>
<td class="bg_all">
<div class="bg_count" style="width:<%# ((int)Eval("Count"))*10 %>px;">1</div>
</td>
<td><%# Eval("Count")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</form>
</body>
</html>
public partial class RepeaterTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<ModelTest> modelList = new List<ModelTest>() {
new ModelTest(){Name="土建相关",Count=4,AllCount=27},
new ModelTest(){Name="工商管理相关",Count=4,AllCount=27},
new ModelTest(){Name="市场营销相关",Count=3,AllCount=27},
new ModelTest(){Name="电子工程相关",Count=2,AllCount=27},
new ModelTest(){Name="贸易相关",Count=2,AllCount=27},
new ModelTest(){Name="金融相关",Count=1,AllCount=27},
new ModelTest(){Name="中国语言文学相关",Count=1,AllCount=27},
new ModelTest(){Name="公共管理相关",Count=1,AllCount=27},
new ModelTest(){Name="信息工程相关",Count=1,AllCount=27}
};
Repeater1.DataSource = modelList;
Repeater1.DataBind();
}
}
public class ModelTest
{
public string Name { get; set; }
public int Count { get; set; }
public int AllCount { get; set; }
}
运行效果图:
样式还是在外面写吧
可以找个报表控件