Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i want to call method from class (pagedataaccess.cs) to masterpage (MasterMain)

this is code of pagedataaccess class

C#
protected  Dataaccess DA = new Dataaccess();

   protected void Page_unLoad(object sender, EventArgs e)
   {
       DA.closecon();
   }


and in masterpage

C#
public partial class MasterMain : pagedataaccesscs


when open default page that inherit from mastemain

i get this error

Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Posted
Updated 27-Jul-11 12:21pm
v2

1 solution

Do what the error says, make sure it matches and extends the right class. The way I access the master page is, I derive all pages from a basepage class. In that class, I expose an instance of MasterMain, which I get by taking the Master property and casting it. Then I have a strongly typed instance to access master page properties and methods.
 
Share this answer
 
Comments
shms_rony 27-Jul-11 19:41pm    
sorry ..iam not understand what do you mean

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900