Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
![]() |
•
•
Join Date: Sep 2005
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hi,
I've been modifying the ASPNetStore Application to create my own. Everything's been working fine, but I recently had to reinstall VS.NET. Now I am getting the following error on both the ASPNetStore app. as well as on my custom app. Here is the code for my custom app:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using StoreComponents;
namespace Pearls.SaltWaterPearls
{
/// <summary>
/// Summary description for Product.
/// </summary>
public class Product : System.Web.UI.Page
{
protected System.Web.UI.WebControls.PlaceHolder plhProductTemplate;
protected System.Web.UI.WebControls.Label lblProductName;
void Page_Load(Object sender , EventArgs e)
{
int intProductID;
string strProductTemplate;
ProductTemplate objProductTemplate;
intProductID = System.Convert.ToInt32(Context.Items[ "ProductID" ]);
strProductTemplate = CachedData.GetProductTemplate( intProductID );
strProductTemplate = string.Format( "ProductTemplates/{0}.ascx", strProductTemplate );
objProductTemplate = (StoreComponents.ProductTemplate)LoadControl( strProductTemplate );
plhProductTemplate.Controls.Add( objProductTemplate ) ;
lblProductName.Text = objProductTemplate.ProductName.ToString();
}
}
The error occurs at the line:
objProductTemplate = (StoreComponents.ProductTemplate)LoadControl( strProductTemplate );
It's very puzzling since it worked for several months prior to reinstalling the software. I'd appreciate any insight which can help me solve this problem.
Thanks in advance
Todd
I've been modifying the ASPNetStore Application to create my own. Everything's been working fine, but I recently had to reinstall VS.NET. Now I am getting the following error on both the ASPNetStore app. as well as on my custom app. Here is the code for my custom app:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using StoreComponents;
namespace Pearls.SaltWaterPearls
{
/// <summary>
/// Summary description for Product.
/// </summary>
public class Product : System.Web.UI.Page
{
protected System.Web.UI.WebControls.PlaceHolder plhProductTemplate;
protected System.Web.UI.WebControls.Label lblProductName;
void Page_Load(Object sender , EventArgs e)
{
int intProductID;
string strProductTemplate;
ProductTemplate objProductTemplate;
intProductID = System.Convert.ToInt32(Context.Items[ "ProductID" ]);
strProductTemplate = CachedData.GetProductTemplate( intProductID );
strProductTemplate = string.Format( "ProductTemplates/{0}.ascx", strProductTemplate );
objProductTemplate = (StoreComponents.ProductTemplate)LoadControl( strProductTemplate );
plhProductTemplate.Controls.Add( objProductTemplate ) ;
lblProductName.Text = objProductTemplate.ProductName.ToString();
}
}
The error occurs at the line:
objProductTemplate = (StoreComponents.ProductTemplate)LoadControl( strProductTemplate );
It's very puzzling since it worked for several months prior to reinstalling the software. I'd appreciate any insight which can help me solve this problem.
Thanks in advance
Todd
![]() |
Similar Threads
Other Threads in the ASP.NET Forum
- Help with a cast error (ASP.NET)
- Calling a class upon button click (C#)
- CPU at 100%, CWSMsconfig etc.... hijackthis log posted (Viruses, Spyware and other Nasties)
- web form not working please help (ASP.NET)
- Cant figure out second half of piramid (Java)
- Total Newbie Could Use A Pointer In The Right Direction (C++)
- Reformat or use Imaging backup? (Windows tips 'n' tweaks)
- Java Programmers wanted. Need Help please (Java)
- ADO.NET Specified cast is not valid (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: transfer page
- Next Thread: How to Hash and Store in Database
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode