Reputation: 11146
I have public variable 'MessagePlaceholder' on MasterPage and a Class that accesses this property like that setting it's value to string from getMessage();
((HttpContext.Current.Handler as System.Web.UI.Page).Master as MasterPage).MessagePlaceholder = getMessage();
which gives me an error like this one
Error 3 'System.Web.UI.MasterPage' does not contain a definition for 'MessagePlaceholder' and no extension method 'MessagePlaceholder' accepting a first argument of type 'System.Web.UI.MasterPage' could be found (are you missing a using directive or an assembly reference?)
What should i do ?
Upvotes: 0
Views: 343
Reputation: 460340
You have added the variable MessagePlaceHolder in your masterpage. That means you have extended the functionality of a standard Masterpage.
You have to cast the Master property to your type of the Masterpage.
((MyMasterClass)((Page)HttpContext.Current.Handler).Master).MessagePlaceHolder = getMessage();
or in VB.Net
DirectCast(DirectCast(HttpContext.Current.Handler, Page).Master, MyMasterClass).MessagePlaceHolder = getMessage()
Upvotes: 1