【问题标题】:Response.redirect for MS ChartMS Chart 的 Response.redirect
【发布时间】:2011-04-27 14:02:58
【问题描述】:

我有一个图表控件。

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

我试过了,但点击甚至不起作用..

   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");
        }

    }

我知道我们可以在 Html 中放置一个 URL,但是我不能在其中放置一个条件......?

我们将不胜感激。

谢谢

<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>

【问题讨论】:

  • 我认为您所写的内容本身没有任何问题。当您说“点击甚至 [原文如此] 不起作用”时,您的意思是事件没有触发吗?或者 Response.Redirects 没有按您的计划工作?尝试调试您的应用程序并在单击处理程序上设置断点以查看事件过程是否正在执行,并告诉我会发生什么。

标签: c# asp.net response mschart


【解决方案1】:

你能发布图表的设计视图吗?

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

【讨论】:

  • 编辑后的代码只有在我们点击图表区域内的系列/点时才会触发,而不是图表上的任何位置。
  • 嗨,谢谢你的代码..第二行有问题..它说名字必须是一个int..我也很安静明白我们为什么要使用它..??欣赏它..
  • 我猜你不需要使用第二个,我只是举了一个例子,如果你使用的是积分,那么你可以用它把它传递到另一个页面来执行一些逻辑,如果你发现任何方式有用的标记它作为回答欢呼
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多