我下面的代码有问题,我需要创建一个显示图表的页面,以及一个下拉列表来更改图表类型
图表显示正确,但下拉列表控件不执行任何操作,有人可以帮忙吗?我还希望在 3 种图表类型上选择 3D
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="admin_test" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<script type="text/javascript" language="javascript">
function showContent(i) {
if (document.getElementById('statContent' + i).style.display == 'none') {
document.getElementById('statContent' + i).style.display = 'block';
} else {
document.getElementById('statContent' + i).style.display = 'none';
}
}
</script>
choose chart display type:
<asp:dropdownlist id="ChartTypeList" runat="server" AutoPostBack="True"
CssClass="spaceright" Width="112px">
<asp:ListItem Value="Column" Selected="True">Column 2D</asp:ListItem>
<asp:ListItem Value="Column">Column 3D</asp:ListItem>
<asp:ListItem Value="Line">Line 2D</asp:ListItem>
<asp:ListItem Value="Line">Line 3D</asp:ListItem>
<asp:ListItem Value="Pie">Pie 2D</asp:ListItem>
<asp:ListItem Value="Pie">Pie 3D</asp:ListItem>
</asp:dropdownlist><br />
<asp:Chart ID="Chart1" runat="server" DataSourceID="SqlDataSource1" >
<series>
<asp:Series Name="Series1" ChartType="Pie" XValueMember="suburb"
YValueMembers="username">
</asp:Series>
</series>
<chartareas>
<asp:ChartArea Name="ChartArea1">
</asp:ChartArea>
</chartareas>
</asp:Chart>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT suburb, COUNT(username) AS username FROM member GROUP BY suburb">
</asp:SqlDataSource>
</asp:Content>