toddpinksen 0 Newbie Poster

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.