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.

using MonoX built in modules  (Mono Support )

Viewed 65997 time(s), 18 post(s) 1/6/2011 9:12:02 AMby inanc
inanc

inanc

2/14/2011 9:39:41 PM
Hello,
MonoX look like really impressive. I would like to learn how to develop custom applications using it. And I have a problem with using MonoX built in modules. For example lets look EditProfile module. The location of the control is Monox/ModuleGallery/ProfileModule/EditProfile.ascx.

First of all I've created a new webform in the root folder with name WebForm1.aspx. The html included on aspx part is:
<%@ Page Title="" Language="C#" MasterPageFile="/MonoX/MasterPages/Default.master" AutoEventWireup="true" Theme="Default" CodeBehind="dene.aspx.cs" Inherits="ProjectName.Web.dene1" %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %> 
<%@ Register TagPrefix="MonoX" TagName="dene" Src="/dene.ascx" %>
<%@ Register TagPrefix="MonoX" TagName="Search" Src="/MonoX/ModuleGallery/ProfileModule/UserProfile.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
<table>
    <tr>
        <td>
            <portal:PortalWebPartZone HeaderText="Left part zone" ID="PortalWebPartZone1" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm" ShowChromeForNonAdmins="true">
                <ZoneTemplate>
                    <Monox:Search runat="server" ID="UserProfile" Title="Merhaba İnançç" />
                </ZoneTemplate>
            </portal:PortalWebPartZone>   
        </td>
    <td>
        <portal:PortalWebPartZone HeaderText="Left part zone" ID="leftWebPartZone" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm" ShowChromeForNonAdmins="true">
                <ZoneTemplate>
                    <Monox:dene runat="server" ID="helloWorldSample" Title="Hello İnanç" />
                </ZoneTemplate>
            </portal:PortalWebPartZone>   
    </td>
    </tr>
</table>
</asp:Content>


and on the code behind part, the included code is:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace ProjectName.Web
{
    public partial class dene1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            UserProfile.Title = "Example Title";
            UserProfile.UserId = new Guid("67C919E2-8DF4-476A-B312-C26F82A36CFB");
        }
    }
}


And I could not achieve to reach what I want. My wishi is to see a part on the form that makes the user to enable the edit the profile of the user with given UserId. The UserId given above for the example belongs the admin user. But I could not see the UserProfile on the form. It says:User does not exist. User does not exist. What should I do?Thanks
Inanc
This content has not been rated yet. 
469 Reputation 60 Total posts
inanc

inanc

1/6/2011 3:51:03 PM
Ok. Now I can see an panel with empty textboxes ..I mean how can I use this module to fill up the related text boxes with User Profile data.
Thanks
Inanc
This content has not been rated yet. 
469 Reputation 60 Total posts
denis

denis

1/6/2011 6:06:54 PM
Hi Inanc,
There are two problems with your code:
1. every page in the MonoX solution should inherit from MonoSoftware.MonoX.BasePage. We recommend that you initially create your own BasePage for every custom solution that inherits from MonoX BasePage, and use it thorough the project.
2. you put a search part on the page and gave it the ID "UserProfile" which is rather confusing. It appears that you simply used a wrong part. Please use the front end code from here: /MonoX/Pages/SocialNetworking/UserProfile.aspx You will be using the part that is located at /MonoX/ModuleGallery/ProfileModule/UserProfileModule.ascx, and not the search part. After that, you will be able to set the UserId of the UserProfile control (do it in the Init event).
This content has not been rated yet. 
7207 Reputation 956 Total posts
inanc

inanc

2/14/2011 9:42:46 PM
Dear Denis,
Good morning. On your forum page with the URL:
[url]http://www.mono-software.com/Forum/default.aspx?g=posts&t=162[/url]
it was mentioned that:
New portal pages are dynamically instantiated using the Page management administrative pane.
This process works by copying the desired template page to the desired folder under the name given
to it by the user. Template pages are actually ordinary ASPX pages WITHOUT the accompanying
codebehind files. They usually inherit from the MonoSoftware.MonoX.BasePage class, but you can
create a different class file and use it if you need to implement some kind of codebehind functionality.
Here is a code sample for the default template page:
<%@ Page
Language="C#"
MasterPageFile="/MonoX/MasterPages/Default.master"
AutoEventWireup="true"
Inherits="MonoSoftware.MonoX.BasePage"
Theme="Default"
Title=""
%>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>
<%@ Register TagPrefix="MonoX" TagName="Editor" Src
="/MonoX/ModuleGallery/MonoXHtmlEditor.ascx" %>
<%@ Register Assembly="MonoX.Library" Namespace="MonoSoftware.MonoX"
TagPrefix="portal" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
... HTML and ASP.NET markup goes here ...
</asp:Content>


By referencing to this decleration and your advice I've created a webform including the code below

<%@ Page Title="" Language="C#" MasterPageFile="/MonoX/MasterPages/Default.master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="MonoSoftware.MonoX.BasePage" %>
  
<%@ Page
Language="C#"
MasterPageFile="/MonoX/MasterPages/Default.master"
AutoEventWireup="true"
Inherits="MonoSoftware.MonoX.BasePage"
Theme="Default"
Title=""
%>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>
<%@ Register TagPrefix="MonoX" TagName="UserProfile" Src="/prjDene/WebParts/UserProfileModule.ascx" %>
<%@ Register Assembly="MonoX.Library" Namespace="MonoSoftware.MonoX"TagPrefix="portal" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
    <MonoX:UserProfile ID="UserProfile" runat="server" UserId="67C919E2-8DF4-476A-B312-C26F82A36CFB"></MonoX:UserProfile>
</asp:Content>


Before creating the form, I've copied the UserProfile.ascx control file underthe prjDene folder. As you can see I've registered the usercontrol ascx file on my webform1 page.
But I could not achieve the job that I want. It says that :
An error has occured in the application.
This event has been logged and will be addressed by the maintenance department. We appreciate your patience.

Where do I go wrong I could not understand.Everything seems right.And where has that event been logged? I can't see any log under '~\monox\ApplicationData\Logs'.

And what about the custom basepage that can be used through all the project you mentioned?
I wonder if there is a new , more detailed Monox manual you have? Specially on custom projects and skinning.

Thank you for your patience.
Inanc



This content has not been rated yet. 
469 Reputation 60 Total posts
denis

denis

2/14/2011 9:44:46 PM
Hi Inanc,
it seems that we have several misunderstandings and I still cannot understand what are you truing to achieve. If your goal is to put a profile module on the page (like on this page http://monox.mono-software.com/profile/Jenny/), please consider this:

1. are you trying to create an ordinary page or a template page? Template pages serve as a template for other pages that are created dynamically in the Page management section. For example, it could make sense if you want to have a lot of dynamically created pages with the UserProfile module. From your initial code I thought that you are creating an ordinary page, now you are putting the template pages in the picture. Are you going to create pages using Visual Studio or are you going to create pages dynamically via the Page management section?
2. all pages in the MonoX project must inherit from the MonoX BasePage class. You can be as flexible as you want with this and use your custom BasePage class that inherits from MonoX class.
3. all Web parts must inherit from the MonoX BasePart class.

Your initial example is a page that has a Search part that is called UserProfile?!? Search part does not have the UserId property and I am at lost here.

Please try to use this simple code - it should run without the problems, so we could move on.
Page front end: 

<%@ Page Title="" Language="C#" MasterPageFile="/MonoX/MasterPages/Default.master" AutoEventWireup="true" Theme="Default" CodeBehind="dene.aspx.cs" Inherits="ProjectName.Web.dene" %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %> 
<%@ Register TagPrefix="MonoX" TagName="EditProfile" Src="/MonoX/ModuleGallery/ProfileModule/UserProfileModule.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
<table>
    <tr>
        <td>
            <portal:PortalWebPartZone HeaderText="Left part zone" ID="PortalWebPartZone1" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm" ShowChromeForNonAdmins="true">
                <ZoneTemplate>
<MonoX:EditProfile id="ctlProfile" runat="server" IsPreviewMode="true" AutoDetectUser="false"></MonoX:EditProfile>                     
                </ZoneTemplate>
            </portal:PortalWebPartZone>   
        </td>
    <td>
        <portal:PortalWebPartZone HeaderText="Left part zone" ID="leftWebPartZone" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm" ShowChromeForNonAdmins="true">
                <ZoneTemplate>
  
                </ZoneTemplate>
            </portal:PortalWebPartZone>   
    </td>
    </tr>
</table>
</asp:Content>


Page code behind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace ProjectName.Web
{
    public partial class dene : MonoSoftware.MonoX.BasePage
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            ctlProfile.UserId = new Guid("67C919E2-8DF4-476A-B312-C26F82A36CFB");
        }
    }
}
This content has not been rated yet. 
7207 Reputation 956 Total posts
inanc

inanc

2/14/2011 9:45:22 PM
Hello Denis,
Thank you for your answer. I tried your code. But unfortunately :

Error 5 Partial declarations of 'ProjectName.Web.dene' must not specify different base classes C:\monox\dene.aspx.cs 10 26 Portal
Error 9 The name 'ctlProfile' does not exist in the current context C:\monox\dene.aspx.cs 14 13 Portal

and a warning
Message 7 Validation (ASP.Net): Attribute 'IsPreviewMode' is not a valid attribute of element 'EditProfile'. C:\monox\dene.aspx 12 75 Portal
This content has not been rated yet. 
469 Reputation 60 Total posts
inanc

inanc

1/7/2011 1:49:21 PM
Denis,
I am trying to create an ordinary page that will show a user profile. Not a template page!
Interestingly I have no problems with a for example login module.

I am just trying to show some user's profile. Forexample TimC comes in and looks for the Jenny's profile.Thats all.Thank you
This content has not been rated yet. 
469 Reputation 60 Total posts
denis

denis

2/14/2011 9:46:39 PM
This functionality is already provided by MonoX user profile page, but in case you want to experiment with it, here is the minimal code - I compiled and ran it successfully. Please change the class namespace (in my example it is Mono.Web.Pages) as it fits your project.

Front end:
<%@ Page 
    Title=""
    Language="C#"
    MasterPageFile="/MonoX/MasterPages/Default.Master"
    AutoEventWireup="true"
    CodeBehind="TestProfile.aspx.cs"
    Inherits="Mono.Web.Pages.TestProfile"
    Theme="Default" %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>   
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register TagPrefix="MonoX" TagName="EditProfile" Src="/MonoX/ModuleGallery/ProfileModule/UserProfileModule.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
  
  
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">    
<table border="0" cellspacing="0" cellpadding="0" class="user-profile">
        <tr>
            <td class="left-section">
                <portal:PortalWebPartZone HeaderText='<%$ Code: PageResources.Zone_LeftPartZone %>' ID="leftPartZone" runat="server" Width="100%" ChromeTemplateFile="LeftColumn.htm">
                    <ZoneTemplate>                                                    
                        <MonoX:EditProfile id="ctlProfile" runat="server" IsPreviewMode="true" AutoDetectUser="false" HiddenFieldsString="FirstName,LastName" >
                            <EditTemplate>                                
                            </EditTemplate>
                            <PreviewTemplate>
                            </PreviewTemplate>
                        </MonoX:EditProfile>                                                
                    </ZoneTemplate>
                </portal:PortalWebPartZone>
            </td>
            <td class="right-section"
            </td>
        </tr>
    </table>
      
</asp:Content>

Codebehind:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace Mono.Web.Pages
{
    public partial class TestProfile : BasePage
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            ctlProfile.UserId = new Guid("67C919E2-8DF4-476A-B312-C26F82A36CFB");
        }
    }
}
This content has not been rated yet. 
7207 Reputation 956 Total posts
inanc

inanc

2/14/2011 9:50:08 PM
Dear Denis,
Yes this functionality is already available. But I would like to build a dating site. And these profile fields are not compatible and sufficient for my wishes. I should reconstruct the user profile fields.Thatswhy I would like to test some modules. There are somehow interesting points. Let me clarify some points to prevent misunderstandings.

There is one point that I could not understand. I have created a test page with the name TestLogin.aspx and it works without any problem naturally. The code for the TestLogin.aspx page is given below.

aspx part:


<%@ Page Title="" Language="C#" MasterPageFile="/MonoX/MasterPages/Default.master" AutoEventWireup="true" CodeBehind="TestLogin.aspx.cs" Inherits="ProjectName.Web.TestLogin"  Theme="Default"%>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>   
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register TagPrefix="MonoX" TagName="Login" Src="/MonoX/ModuleGallery/LoginModule.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
<portal:PortalWebPartZone>
    <ZoneTemplate>
    <MonoX:Login ID="Login1" runat="server" ></MonoX:Login>
    </ZoneTemplate>
  
</portal:PortalWebPartZone>
  
</asp:Content>

and the cs part:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX;
  
namespace ProjectName.Web
{
    public partial class TestLogin : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Login1.ShowOpenIdLogin = false;
        }
    }
}

As a result I have no problem with the built in Login module.
But, in a exactly same manner I 've created the page TestProfile.aspx. Meanwhile the last code you've sent for me did not worked. And the code for the TestProfile.aspx is:

aspx part:

<%@ Page
    Title=""
    Language="C#"
    MasterPageFile="/MonoX/MasterPages/Default.Master"
    AutoEventWireup="true"
    CodeBehind="TestProfile.aspx.cs"
    Inherits="ProjectName.Web.TestProfile"
    Theme="Default" %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>   
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register TagPrefix="MonoX" TagName="EditProfile" Src="/MonoX/ModuleGallery/ProfileModule/UserProfileModule.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>
  
  
<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">   
<table border="0" cellspacing="0" cellpadding="0" class="user-profile">
        <tr>
            <td class="left-section">
                <portal:PortalWebPartZone HeaderText='<%$ Code: PageResources.Zone_LeftPartZone %>' ID="leftPartZone" runat="server" Width="100%" ChromeTemplateFile="LeftColumn.htm">
                    <ZoneTemplate>                                                   
                        <MonoX:EditProfile id="ctlProfile" runat="server" IsPreviewMode="true" AutoDetectUser="false" HiddenFieldsString="FirstName,LastName" >
                            <EditTemplate>                               
                            </EditTemplate>
                            <PreviewTemplate>
                            </PreviewTemplate>
                        </MonoX:EditProfile>                                               
                    </ZoneTemplate>
                </portal:PortalWebPartZone>
            </td>
            <td class="right-section"
            </td>
        </tr>
    </table>
     
</asp:Content>


and the cs part:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MonoSoftware.MonoX;
  
namespace ProjectName.Web
{
    public partial class TestProfile : BasePage
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            ctlProfile.UserId = new Guid("c2a9139e-e885-4d38-8c6d-b537bc150ad9");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
             
        }
    }
}

I really could not understand why it doesn't work. Both of the two pages have the same structure and inheritance. I need help. Furthermore , I think this is the simplest part! I am very doubtful for the skinning. :)
Thank you very much for your patience again..
This content has not been rated yet. 
469 Reputation 60 Total posts
denis

denis

1/8/2011 5:33:14 PM
Is the error message same as before? I think that you should send us a complete custom project, since this must be some sort of configuration error, as such simple parts should work without so much troubles.
This content has not been rated yet. 
7207 Reputation 956 Total posts
1 2