Reputation: 20078
i am using asp.net framework 4 and i have created brand new project and below is the code and when i compile the proj i get this below errors... i have already spent good amount of time but not sure whats going on here...
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.HtmlControls;
namespace aspnet_membership_proj
{
public partial class SiteMaster : MyBaseMasterPage
{
public void Page_Load(object sender, EventArgs e)
{
HtmlGenericControl myJs = new HtmlGenericControl();
myJs.TagName = "script";
myJs.Attributes.Add("type", "text/javascript");
myJs.Attributes.Add("language", "javascript"); //don't need it usually but for cross browser.
myJs.Attributes.Add("src", ResolveUrl("~/Scripts/JScript.js"));
this.Page.Header.Controls.Add(myJs);
}
}
}
errors:
The name 'ResolveUrl' does not exist in the current context
'aspnet_membership_proj.SiteMaster' does not contain a definition for 'Page' and no extension method 'Page' accepting a first argument of type 'aspnet_membership_proj.SiteMaster' could be found (are you missing a using directive or an assembly reference?)
Upvotes: 0
Views: 3343
Reputation:
Check your MyBaseMasterPage class. That is where the problem lies. Also, Make sure that your MyBaseMasterPage class derives from System.Web.UI.MasterPage.
Upvotes: 1