我有一個問題,我下面的代碼,我需要做一個頁面顯示的圖表,以及一個下拉列表,以正確地更改圖表類型下拉列表不改變圖圖表
圖表顯示,但在下拉列表控件一樣沒有,任何人都可以幫忙?我也想選擇去3D在3種圖表類型
<%@ 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>
你建議不起作用的變化(onselectedindexchanged = 「ChartTypeList_SelectedIndexChanged」)和(保護無效ChartTypeList_SelectedIndexChanged(對象發件人,EventArgs e)條) – user1725978
在什麼意義上的 「不工作」?你有錯誤嗎?發佈代碼作爲您的問題編輯創建的,所以我們對您嘗試做的事情有一定的瞭解。 – peroija