MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

How to add a new page ?  (Mono Support )

Viewed 3438 time(s), 4 post(s) 4/28/2014 8:21:52 PMby super
super

super

4/28/2014 8:21:52 PM
I know how to add a page dynamically from the administration panel.

I create a test page but it seems like add dynamic pages do not have .CS file with it ? where is the .CS f ile get saved ?

I need .CS file for custom code so I added a new page using Visual Studio.

but when I run the page, I get error ? am I adding the page incorrectly ? I just did: right click > add new > new web form page (with default.master as master page).
This content has not been rated yet. 
6018 Reputation 709 Total posts
super

super

4/28/2014 8:25:17 PM
Here is the Error:

2014-04-28 16:25:37,459 [38] ERROR MonoX [BaseHttpApplication] - Application Error
System.Web.HttpCompileException (0x80004005): c:\monox\morepages\Default.aspx.cs(14): error 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).
   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
   at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp)
   at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
   at System.Web.UI.PageHandlerFactory.GetHandler(HttpContext context, String requestType, String virtualPath, String path)
   at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
This content has not been rated yet. 
6018 Reputation 709 Total posts
super

super

4/28/2014 8:40:02 PM
Here is my code:

Default.aspx
<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="MonoSoftware.MonoX.BasePage" Theme="Default" MasterPageFile="/MonoX/MasterPages/Default.master" %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>
 
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register TagPrefix="MonoX" TagName="Editor" Src="/MonoX/ModuleGallery/MonoXHtmlEditor.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">            
    <div class="content-wrapper two-columns">
        <div class="main-content">
            <portal:PortalWebPartZone HeaderText="Content zone" ID="contentPartZone" runat="server" Width="100%" ChromeTemplateFile="Standard.htm">
                <ZoneTemplate>
                    <MonoX:Editor ID="ctlEditor" runat="server" Title=""></MonoX:Editor>
 
                </ZoneTemplate>
            </portal:PortalWebPartZone>
        </div>
        <div class="side-content">
            <portal:PortalWebPartZone HeaderText="Right part zone" ID="rightPartZone" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm" ShowChromeForNonAdmins="true">
                <ZoneTemplate>
                    <MonoX:Editor runat="server" ID="editor2" /> 
                </ZoneTemplate>
            </portal:PortalWebPartZone>
        </div>
    </div>
</asp:Content>



Default.aspx.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX.Utilities;
 
 
namespace MonoSoftware.MonoX.Pages
{
 
    public partial class P_Default : BasePage
    {
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            JavascriptUtility.RegisterClientScriptInclude(this, Paths.MonoX.Scripts.purl_js);
        }
    }
}
This content has not been rated yet. 
6018 Reputation 709 Total posts
khorvat

khorvat

4/29/2014 6:36:49 AM
Hi,

you have to state your page in the inherits statement so please change the 
"Inherits="MonoSoftware.MonoX.BasePage"" to "Inherits="MonoSoftware.MonoX.Pages.P_Default"" and this should work.

Please note that dynamically created pages doesn't have code behind so you have to manually add code behind file. Also it is very important to distinguish ASP.NET related question to MonoX questions and this one is purely related to ASP.NET basics and it should be posted rather to Stackoverflow than M;onoX forum.

Regards
This content has not been rated yet. 
15993 Reputation 2214 Total posts