[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1155
  • Last Modified:

Master pages Need to Derive from Obout DLL with Code Behind

I have a master page (I am actually nesting masters - it is my top level master) that is using a code behind page that needs to inherit from the Obout AJAX page (as described here:  http://www.obout.com/AJAXpage/howitworks.aspx).  The problem is, I can't make it work.  It seems no matter what I try to do there is an error.  Here is what I have:

In the m.master page (my top level master) I have the following:
<%@ Master Language="VB" CodeFile="m.master.vb" Inherits="masterpages_m" %>
<%@ Register TagPrefix="oajax" Namespace="OboutInc" Assembly="obout_AJAXPage" %>
<%@ Register Assembly="obout_Combobox_NET" Namespace="OboutInc.Combobox" TagPrefix="obout" %>

In the code behind file:
Partial Class masterpages_m : Inherits OboutInc.oboutAJAXPage

    'Inherits System.Web.UI.MasterPage

End Class


Which gives me the error:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

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).

Source Error:

Line 1:  
Line 2:  Partial Class masterpages_m : Inherits OboutInc.oboutAJAXPage
Line 3:  
Line 4:      'Inherits System.Web.UI.MasterPage

Source File: D:\inetpub\vhosts\hh76.org\httpdocs\masterpages\m.master.vb    Line: 2



This is probably simple - I am an old ASP programmer finally making the switch - and perhaps biting off more than I can chew on the first time out.  Let me know your thoughts.

P.S. - I have tried changing the Inherits tag in the m.master page and got the expected error that it needs to match up with the code behind (that is my summary anyway).

0
brandonmonahan
Asked:
brandonmonahan
  • 4
  • 2
2 Solutions
 
NazoUKCommented:
From looking at the page you linked to, it's your content pages that should be derived from OboutInc.oboutAJAXPage not your master page.
0
 
jamesrhCommented:
I believe the problem  is that the base type of oboutAJAXPage is System.Web.UI.Page and masterpages_m needs to inherit from something that dirives from System.Web.UI.MasterPage in order to have masterpage functionality.  I see 2 options off the bat.  1) the practical but slightly ugly option:  Don't use masterpages, but use a regular aspx page as the "master" and UserControls where you would use pages/contentplaceholders. 2) Elegant but probably impractical option:  create a custom masterpage class that either 1)derives from oboutAJAXPage and then implements all of the interfaces, etc of a masterpage, or 2) derives from masterpage and reimplements all of the oboutAJAXPage stuff.
0
 
jamesrhCommented:
NazoUK's solution is the right one, if the oboutAJAXPage functionality is not intended to be on the master page itself.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
brandonmonahanAuthor Commented:
Well, that is not what I was hoping for.  I am at a bit of a loss on how to do this cleanly.  Unfortunately, the Obout objects also cannot be used in User Controls - I already tried that...  Again, it has to be connected with a page.  Well, perhaps I can integrate it against the standard AJAX.  What an issue...  Thanks for your help.
0
 
brandonmonahanAuthor Commented:
I am splitting the points because NazoUK had it right but jamesrh really had it nailed down as to what I was trying to do and offered possible solutions...  Thanks.
0
 
jamesrhCommented:
Do you need to use it both in the "Master" and the inner items/controls?
0
 
jamesrhCommented:
If you do need to use the functionality at both levels, you might be able to expose the OboutInc stuff to the user controls through custom properties/methods on the page.  So the "Master" page inherits from OboutInc.oboutAJAXPage and the user controls rely on the fact that they are living inside this page.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now