c# - [TemplateContainer(typeof(MasterPage.Site1))] -


i have error. how can solve it?

cs0426: type name 'site1' not exist in type 'masterpage'

here masterpage code:

enter image description here

you need set inherits attribute on markup of master page qualified class name . saying open "site1.master.cs" , see class name inherits masterpage .if class part of namespace should set youtr inherits attribute [namespace].[classname]

for example in sample project. master page has following directive on top

<%@ master language="c#" autoeventwireup="true" codefile="site.master.cs" inherits="sitemaster" %> 

and codebehind class (site.master.cs) : see sitemaster class master page inherits from. asp.net form engine compiles markup class derives base class behind scenes

public partial class sitemaster : masterpage {     private const string antixsrftokenkey = "__antixsrftoken";     private const string antixsrfusernamekey = "__antixsrfusername";     private string _antixsrftokenvalue;      protected void page_init(object sender, eventargs e)  } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -