473,803 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Casting a page as Previous Page

I have a problem with a Visual Studio 2005 web project.

I have two pages. SelectProject.a spx and ShowProject.asp x

The first page ( SelectProject.a spx) has two drop down lists.

After the user selects the value in the first drop list the second
filters. That works fine.

But when I click the run report button to pass the data to the
ShowProject.asp x page I get and error like this:

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name
'SelectProject' could not be found (are you missing a using directive
or an assembly reference?)

Source Error:

Line 227: protected void Page_Load(objec t sender, EventArgs e)
Line 228: {
Line 229: SelectProject prevPage = PreviousPage as
SelectProject;
Line 230: //if previouspage exist then check for parameter
values
Line 231: if (PreviousPage != null)
Source File: c:\Documents and Settings\cgrego ry\My Documents\Visua l
Studio 2005\WebSites\W ebSite4\ShowCha rt.aspx.cs Line: 229

Funny thing is, I NEVER CHANGED THAT LINE IN literally months!!! It
just stops working.

Here is the code:
using System;
using System.Data;
using System.Drawing;
using System.Drawing. Drawing2D;
using System.Collecti ons;
using System.Collecti ons.Specialized ;
using System.Configur ation;
using System.Text;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;
using dotnetCHARTING;
using System.Data.Sql Client;

public partial class _Default : System.Web.UI.P age
{
Axis yaxis;
SeriesCollectio n getRandomData()
{
SeriesCollectio n SC = new SeriesCollectio n();
Random myR = new Random();
for (int a = 0; a < 4; a++)
{
Series s = new Series();
s.Name = "Series " + a;
for (int b = 0; b < 5; b++)
{
Element e = new Element();
e.Name = "E " + b;
e.YValue = myR.Next(50);
s.Elements.Add( e);
}
SC.Add(s);
}
// Set Different Colors for our Series
SC[0].DefaultElement .Color = Color.FromArgb( 49, 255, 49);
SC[1].DefaultElement .Color = Color.FromArgb( 255, 255, 0);
SC[2].DefaultElement .Color = Color.FromArgb( 255, 99, 49);
SC[3].DefaultElement .Color = Color.FromArgb( 0, 156, 255);

return SC;
}
void GetAxis()
{
// Create a second Y axis
this.yaxis = new Axis("Percent") ;

// Set the values to percernt
this.yaxis.Perc ent = true;

// Set the maximum value
this.yaxis.Maxi mum = 100;

// Set what side of the chart area it will appear
this.yaxis.Orie ntation = dotnetCHARTING. Orientation.Rig ht;
}

SeriesCollectio n GetChartData(St ring p_proj, String p_labor)
{
SeriesCollectio n sc = new SeriesCollectio n();
SqlConnection NorfolkConn = new SqlConnection(" Data
Source=<snip>\\ GSERVER2K3;Inte grated Security=SSPI;I nitial
Catalog=Norfolk ");
DataEngine de = new DataEngine(Norf olkConn);
//DataEngine de1 = new DataEngine(Norf olkConn);
DateTime dt = DateTime.Today;
//Build my query statement
StringBuilder qry = new StringBuilder(" Select * from
dbo.getChartDat a(",80);
qry.Append("'"+ p_proj +"'");
qry.Append(",") ;
qry.Append("'" + p_labor +"'");
qry.Append(")") ;
StringBuilder qry1 = new StringBuilder(" Select * from
dbo.CalculatePl an2(", 80);
qry1.Append("'" + p_proj + "'");
qry1.Append("," );
qry1.Append("'" + p_labor + "'");
qry1.Append(",' "+ dt +"')");
// Open Connection - dont open connections sooner then you have to
and close them as soon as possible
NorfolkConn.Ope n();

//Create command object and give it the command and connection
SqlCommand selectCMD = new SqlCommand(qry. ToString(),Norf olkConn);
// Create my data adapter
SqlDataAdapter ChartDataAdapte r = new
SqlDataAdapter( qry.ToString(), NorfolkConn);

// Populate the data set
DataSet dataSet = new DataSet();
ChartDataAdapte r.Fill(dataSet) ;
//Get all my max data values for use in the Legend and Axis
Double l_maxPrimaryY = 0.0;
Double l_maxSecondaryY = 0.0;
Double l_maxJTD = 0.0;
Double l_maxLbrExp = 0.0;
Double l_actcomp = 0.0;
double l_plannedhrs = 0.0;
foreach (DataRow dr in dataSet.Tables[0].Rows)
{
Double l_hrsbud = (Double)dr["HrsBud"];
Double l_lbrexp = (Double)dr["LaborExp"];
Double c_jtd = (Double)dr["JTD"];
l_actcomp = (Double)dr["ActComp"];
//String value if a null is returned from SQL Server
string l_dbnull = "";
if ( l_dbnull.Equals (dr["PlannedHrs "].ToString()) )
{
l_plannedhrs = 0.0;
}
else
{
l_plannedhrs = (Double)dr["PlannedHrs "];
}
//Find the max for the primary Y axis
if (l_hrsbud < c_jtd)
{
l_maxPrimaryY = c_jtd;
}
else
{
l_maxPrimaryY = l_hrsbud;
}
// Find the Max JTD value to display in the Legend Box
if (c_jtd > l_maxJTD)
{
l_maxJTD = c_jtd;
}
if (l_lbrexp > l_maxLbrExp)
{
l_maxLbrExp = Math.Round(l_lb rexp,1);
}
//Find the maximumn value for the secondary Y axis
if (l_lbrexp > 100.0)
{
l_maxSecondaryY = l_lbrexp;
}
else
{
l_maxSecondaryY = 100;
}
}

// Assign the sqlDataReader to the chart data engine
de.Data = dataSet.Tables[0];
// Loop throw the rows and mapp the columns to chart data elements
StringBuilder tokenStr = new StringBuilder() ;
tokenStr.Append ("XValue=lddate ,YValue=Planned hrs");
tokenStr.Append (",YValue=Labor Exp");
tokenStr.Append (",YValue=JTD") ;
tokenStr.Append (",YValue=ActCo mp");

//Set the max Y Value for the primary Y axis
Chart1.YAxis.Ma ximum = l_maxPrimaryY + 100;
//Set the max Y Value for the secondary Y Axis
GetAxis();
//Added 10 to the max percentage to extend the chart and
//prevent the Actual Complete series from begin cut off
this.yaxis.Maxi mum = l_maxSecondaryY + 10;
//Add the token string to the data engine
de.DataFields = tokenStr.ToStri ng();
//Format the XAxis
de.FormatString = "d";
//Get the series collection from the data engine
sc.Add(de.GetSe ries());
ChartDataAdapte r.SelectCommand = new SqlCommand(qry1 .ToString(),
NorfolkConn);
dataSet.Clear() ;
ChartDataAdapte r.Fill(dataSet) ;
//de1.DataFields = "YValue=Planned Complete,XValue =lperiod";
//de1.Data = dataSet.Tables[0];
//de1.FormatStrin g = "d";
//Create a series for the planned metrics
Series plannedSeries = new Series();

foreach (DataRow dr in dataSet.Tables[0].Rows)
{
//Create a new element for the series
Element plannedElement = new Element();
//Setting this property changes the axis type to category
plannedElement. Name = dr["lperiod"].ToString();
//plannedElement. XDateTime = (DateTime) dr["lperiod"];
//Add each column value to the appropriate axis
plannedElement. YValue = (Double)dr["planned"];
//Set the tooltip to be the value
plannedElement. ToolTip = dr["planned"].ToString();
//Add the element to the series
plannedSeries.A ddElements(plan nedElement);
}
//sc.Add(de1.GetS eries());
sc.Add(plannedS eries);
// Close the connection
NorfolkConn.Clo se();
bool hasData = false;
// Found out if any series in the collection has no data
if (sc.Count > 0)
{
sc[0].LegendEntry.Na me = "Planned Hours";
sc[0].LegendEntry.Va lue = l_plannedhrs.To String();
//Set Labor Expended to secondary Y axis
sc[1].YAxis = this.yaxis;
sc[1].LegendEntry.Na me = "Labor Expended";
sc[1].LegendEntry.Va lue = l_maxLbrExp.ToS tring();
sc[2].LegendEntry.Na me = "JTD Hours";
sc[2].LegendEntry.Va lue = l_maxJTD.ToStri ng();

sc[3].LegendEntry.Na me = "Actual Complete";
sc[3].LegendEntry.Va lue = l_actcomp.ToStr ing();
//Set Actual Complete to secondary Y axis
sc[3].YAxis = this.yaxis;
sc[4].LegendEntry.Na me = "Planned Complete";
//sc[4].YAxis = this.yaxis;
foreach (Series s in sc)
if (s.Elements.Cou nt != 0)
hasData = true;
}
// If no data was returned from the query display a message
// from the data engine as to what the error message is
if (!hasData)
{
Chart1.NoDataLa bel.Text = de.ErrorMessage ;
}
return sc;
}

//private double round(double l_lbrexp)
//{
//throw new Exception("The method or operation is not
implemented.");
//}
protected void Page_Load(objec t sender, EventArgs e)
{
SelectProject prevPage = PreviousPage as SelectProject;
//if previouspage exist then check for parameter values
if (PreviousPage != null)
{
// Add the chart data from the database based on select
param
if (prevPage != null)
{

Chart1.SeriesCo llection.Add(Ge tChartData(prev Page.ProjectCod e,
prevPage.LaborC ode));
}
}
else
{
Chart1.SeriesCo llection.Add(Ge tChartData("050 4800", "02"));
}
// Set the title.
Chart1.Title="P roject "+prevPage.Proj ectCode+" Labor Code
"+prevPage.Labo rCode;
Chart1.Debug = true;
// Set the Depth
Chart1.Depth = 15;

// Set 3D
Chart1.Use3D = false;

// set the x axis clustering
Chart1.ChartAre a.XAxis.Cluster Columns = false;
//Chart1.DefaultE lement.Marker.V isible = false;
// Set a default transparency
Chart1.DefaultS eries.DefaultEl ement.Transpare ncy = 20;

// Set line new properties
Chart1.DefaultS eries.Line.Widt h = 5;
Chart1.DefaultS eries.Line.Dash Style = DashStyle.Dash;

// Set the Default Series Type
Chart1.DefaultS eries.Type = SeriesType.Spli ne;

// Set the y Axis Scale
Chart1.ChartAre a.YAxis.Scale = Scale.Time;

// Set the x axis label
Chart1.ChartAre a.XAxis.Label.T ext = "Period";

//Set the angle of the labels
Chart1.ChartAre a.XAxis.TickLab elMode = TickLabelMode.A ngled;
// Set the scale of the X Axis to dynamic labeling
//Chart1.XAxis.Fo rmatString = "d";
//Chart1.XAxis.Ti meScaleLabels.D ayTick.Label.Te xt =
"m/dd/yyyy";

// Set the y axis label
Chart1.ChartAre a.YAxis.Label.T ext = "Hours";

// Set the directory where the images will be stored.
Chart1.TempDire ctory = "temp";
// Set the chart size.
Chart1.Width = 800;
Chart1.Height = 550;

}

}
Here is SelectProject.a spx:
using System;
using System.Data;
using System.Configur ation;
using System.Collecti ons;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class SelectProject : System.Web.UI.P age
{
protected void Page_Load(objec t sender, EventArgs e)
{

}
public void ddlProjectCode_ Changed(Object sender, EventArgs e)
{

//Do nothing once form is posted back from this event
//the labor code list will refresh automatically
}
public String ProjectCode
{
get { return DDL_ProjectCode .SelectedValue; }
}
public String LaborCode
{
get { return DDL_LaborCode.S electedValue; }
}
}

Apr 20 '06 #1
3 2566
jd
Wild guess, but perhaps it can't compile SelectProject.a spx or
SelectProject.a psx.cs. Double check these files (the deployed ones,
in the directory referenced in the error message). BTW, I assume
the second file in your message was SelectProject.a spx.cs (not
SelectProject.a spx).

-- jeff

Apr 21 '06 #2
No it cannot compile ShowChart.aspx. cs. But it has been compiling for
the past four months. Why all of a sudden it errors?
I was right clicking on SelectProject.a spx and selecting 'View in
Browser' and testing it out.

All of a sudden it started throwing the error. If the page is there why
would it tell me that?

Apr 21 '06 #3
I should say that it is NOT compiling because of the error I posted
previously. There are no other errors in that file.

Apr 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
9480
by: Razak | last post by:
Hi, I have a class which basically do Impersonation in my web application. From MS KB sample:- ++++++++++++++++++++code starts Dim impersonationContext As System.Security.Principal.WindowsImpersonationContext Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
6
2551
by: Nad | last post by:
Hello, In order to go back to the previous page from a page with possible postbacks I keep Request.Referrer in ViewState and then use it to redirect to the previous page. However I am losing all the information entered in the previous page. I also want to keep the entries in many fields/controls in the previous page. Is there a way to keep the information in the previous page intact when you get back to it?
2
1210
by: mohit | last post by:
I am making a web application in .NET framework. I want to pass an information from one page to another page. I have a class MsgClass in a page and in the another page I created an object of this class MsgClass mc; for handeling I am using the following code void Page_Load() {
3
6197
by: Ron | last post by:
Hi all, I've come across a problem when casting user controls in ASP.NET 2.0, hopefully someone can help. I have a master page with a user control on it (myMenu) that I wish to programmatically access from a content page. Below is how I am trying to do this (this would work in ASP.NET 1.1). DynamicMenu myMenu = (DynamicMenu)((MasterPage)this.Master).FindControl("myMenu");
3
5309
by: laryten | last post by:
Hi, Is there a way to update the same web page instead of getting a new page each time we click the submit button? The simplest thing to do is to delete the current page (or go back to the previous page) and then redraw the page. There are a few possible solutions: 1. Use the same URL again. But a new page will still be created. 2. Use the "onsubmit" option:
4
1436
by: casul | last post by:
Hi All, Given the following code that just defines a dummy class "my_class" and a dummy wrapper "my_wrapper" with a main program : #include <iostream> template< typename _Tag > class my_wrapper {
9
3468
by: Taras_96 | last post by:
Hi everyone, I was experimenting with static_cast and reinterpret cast #include <iostream> struct A1 { int a; }; struct A2 { double d; }; struct B : public A1, A2
2
1983
by: =?Utf-8?B?R2Vvc3Ns?= | last post by:
Dear All, I try to change a master page in the OnPreInit in a asp.net page. (Session variable is guaranteed to have been assigned) protected override void OnPreInit(EventArgs e){ if ((bool)session){ this.MasterPageFile = "~/NewMaster.master"; } else{ this.MasterPageFile = "~/OrigianlMaster.master";
10
3793
by: Alex Vinokur | last post by:
Hi, Is it possible to do C++-casting from const pair<const unsigned char*, size_t>* to const pair<unsigned char*, size_t>* ? Alex Vinokur
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6840
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5496
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2968
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.