2011-04-27 62 views
0

我有一个图表控件。MS Chart的Response.redirect

现在我想要的功能是,如果用户点击图表,它需要它到一个新的页面,我需要发送一个值到该页面。

我试过,但点击甚至不工作..

protected void Chart1_Click(object sender, ImageMapEventArgs e) 
    {   
     if (Label1.Text != "1") 
     { 
      Response.Redirect("~/Admin/Page2Chart.aspx?node=" + Label1.Text); 
     } 
     else 
     { 
      Response.Redirect("~/Admin/Page2Chart.aspx"); 
     } 

    } 

我知道我们可以把一个URL的HTML,但后来我不能把一个条件是....?

任何帮助将不胜感激。

感谢

<asp:Chart ID="Chart4" Height="202px" Width="360px" runat="server" 
          onclick="Chart4_Click" > 
          <Series> 

           <asp:Series ChartType="Pie" Name="Series1" Font="Microsoft Sans Serif, 10pt" > 
           </asp:Series> 
          </Series> 
          <ChartAreas> 
           <asp:ChartArea Name="ChartArea1"> 
           </asp:ChartArea> 
          </ChartAreas> 
          <Legends> 
       <asp:Legend Enabled="true" TableStyle="Tall" IsTextAutoFit="False" Name="Default" BackColor="Transparent" Font="Trebuchet MS, 8.25pt, style=Bold"> 
       </asp:Legend> 
      </Legends> 
     </asp:Chart> 
+0

我看不出你写的东西有什么问题。当你说“点击甚至[原文如此失效]”,你的意思是这个事件没有被解雇?或者Response.Redirects没有按照你的计划工作?尝试调试您的应用程序,并在点击处理程序上设置断点以查看事件过程是否正在执行,并让我知道发生了什么。 – pseudocoder 2011-04-27 14:55:36

回答

0

你可以张贴图表的设计视图。

chart4.Series["seriesname"].Url = "somechartorpage.aspx?"+label1.text;    
chart4.Series["seriesname"].Points["name"].Url= "Detailedchart.aspx"; 
+0

我已编辑..是你想要什么? – user175084 2011-04-27 14:52:44

+0

是工作点数/系列的点击事件 – 2011-04-27 15:11:04

+0

编辑后的代码仅在点击chartarea内部的系列/点时触发,而不是图表上的任何位置。 – 2011-04-27 15:18:01