在目前的情况下不存在
我有低于code:
code背后:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.DataVisualization.Charting;
namespace TestApp2
{
public partial class hookload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["Rig_ID"].Equals(1))
MultiView1.ActiveViewIndex = 0;
else if (Request.QueryString["Rig_ID"].Equals(2))
MultiView1.ActiveViewIndex = 1;
else if (Request.QueryString["Rig_ID"].Equals(3))
MultiView1.ActiveViewIndex = 2;
else if (Request.QueryString["Rig_ID"].Equals(4))
MultiView1.ActiveViewIndex = 3;
else if (Request.QueryString["Rig_ID"].Equals(5))
MultiView1.ActiveViewIndex = 4;
}
}
}
这是我的aspx文件:
And this is my aspx file:
<%@ Page Title="Shannons Proof of Concept Rig Dashboard" Language="C#" MasterPageFile="~/Site.master"
AutoEventWireup="true" CodeBehind="hookload.aspx.cs" Inherits="TestApp2._Default" %>
<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<asp:SqlDataSource ID="SqlDataSource27" runat="server" ConnectionString="<%$ ConnectionStrings:RigDashConnectionString1 %>"
SelectCommand="SELECT TOP (30) tbl_rig.name, tbl_stats.Timestamp AS Expr1, tbl_stats.HookLoad, tbl_stats.Rig_ID FROM tbl_rig INNER JOIN tbl_stats ON tbl_rig.rig_id = tbl_stats.Rig_ID WHERE (tbl_stats.Rig_ID = 2) ORDER BY Expr1 DESC">
</asp:SqlDataSource>
<h2>
Rig Hook Load Stats - Previous 10 minutes</h2>
<p>
<asp:Chart ID="Chart25" runat="server" DataSourceID="SqlDataSource27" Width="900px"
Height="500px" Style="margin-top: 5px" Palette="EarthTones">
<Series>
<asp:Series Name="Rig 24 Hook Load" XValueMember="Expr1" XValueType="Time" YValueMembers="HookLoad"
Legend="Legend" YValuesPerPoint="1" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<Area3DStyle Enable3D="True" LightStyle="Realistic" WallWidth="0" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="Legend" Title="Legend">
</asp:Legend>
</Legends>
</asp:Chart>
</p>
</asp:View>
<asp:View runat="server">
<asp:SqlDataSource ID="SqlDataSource28" runat="server" ConnectionString="<%$ ConnectionStrings:RigDashConnectionString1 %>"
SelectCommand="SELECT TOP (30) tbl_rig.name, tbl_stats.Timestamp AS Expr1, tbl_stats.HookLoad, tbl_stats.Rig_ID FROM tbl_rig INNER JOIN tbl_stats ON tbl_rig.rig_id = tbl_stats.Rig_ID WHERE (tbl_stats.Rig_ID = 3) ORDER BY Expr1 DESC">
</asp:SqlDataSource>
<h2>
Rig Hook Load Stats - Previous 10 minutes</h2>
<p>
<asp:Chart ID="Chart26" runat="server" DataSourceID="SqlDataSource28" Width="900px"
Height="500px" Style="margin-top: 5px" Palette="EarthTones">
<Series>
<asp:Series Name="Rig 21 Hook Load" XValueMember="Expr1" XValueType="Time" YValueMembers="HookLoad"
Legend="Legend" YValuesPerPoint="1" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<Area3DStyle Enable3D="True" LightStyle="Realistic" WallWidth="0" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="Legend" Title="Legend">
</asp:Legend>
</Legends>
</asp:Chart>
</p>
</asp:View>
<asp:View runat="server">
<asp:SqlDataSource ID="SqlDataSource29" runat="server" ConnectionString="<%$ ConnectionStrings:RigDashConnectionString1 %>"
SelectCommand="SELECT TOP (30) tbl_rig.name, tbl_stats.Timestamp AS Expr1, tbl_stats.HookLoad, tbl_stats.Rig_ID FROM tbl_rig INNER JOIN tbl_stats ON tbl_rig.rig_id = tbl_stats.Rig_ID WHERE (tbl_stats.Rig_ID = 5) ORDER BY Expr1 DESC">
</asp:SqlDataSource>
<h2>
Rig Hook Load Stats - Previous 10 minutes</h2>
<p>
<asp:Chart ID="Chart27" runat="server" DataSourceID="SqlDataSource29" Width="900px"
Height="500px" Style="margin-top: 5px" Palette="EarthTones">
<Series>
<asp:Series Name="Rig 22 Hook Load" XValueMember="Expr1" XValueType="Time" YValueMembers="HookLoad"
Legend="Legend" YValuesPerPoint="1" ChartType="Line">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<Area3DStyle Enable3D="True" LightStyle="Realistic" WallWidth="0" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Name="Legend" Title="Legend">
</asp:Legend>
</Legends>
</asp:Chart>
</p>
</asp:View>
</asp:MultiView>
<p>
<a href="..\default.aspx">< Go Back</a>
</p>
</asp:Content>
现在我的问题是,当我尝试运行此,我得到的消息MultiView1'名称''不在当前情况下存在。我真的不明白,为什么我收到此错误,但我也是一个小白所以这并不奇怪。 :)基本上,我有一个ASP:GridView控件表的第一页上,我试图传递参数,然后通过这个网页进行处理,所以当有人点击链接〜\\图\\ hookload.aspx Rig_ID = 2,它处理?多视图索引1,使其显示由SQL查询所描述的相关数据图表。
Now my problem is that when I try to run this, I get the message 'The name 'MultiView1' does not exist in the current context'. I really don't understand why I am getting this error, but I am also a noob so it isn't surprising. :) Basically, I have a asp:gridview table on the first page and I am trying to pass parameters to then be processed by this page so when someone clicks the link for ~\charts\hookload.aspx?Rig_ID=2, it processes MultiView Index 1 so it displays a chart of relevant data as described by the SQL Query.
这一直是我发现到目前为止,要做到这一点,所以如果其他人有一个更好的主意的唯一途径,相信我,我洗耳恭听。我一直在努力找到一个答案,主要是因为我不知道什么搜索关键字。任何帮助将是AP preciated。
This has been the only way I have found so far to do this so if anyone else has a better idea, believe me I am all ears. I have struggled to locate an answer to this, mainly because I don't know what keywords to search for. Any help would be appreciated.
您网页的继承属性必须引用您的支持类的名称。
Inherits attribute of your page must refer to name of your backing class.
纠正你的继承如下:
<%@ Inherits="TestApp2.hookload" Page Title="Shannons Proof of Concept Rig Dashboard" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="hookload.aspx.cs" %>
当你改变一个类的名字,却忘了纠正在aspx文件发生的。
Happens when you change a class name and forget to correct it in the aspx file.