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.

Documentation on writting your own plugin ?  (Mono Support )

Viewed 70894 time(s), 21 post(s) 12/30/2010 6:11:32 PMby shawndg
shawndg

shawndg

2/15/2011 12:59:09 PM
I am happy to report.. i got it to work!!1
Thx for all the guidance a long the way..
For all of you who may be running into the same issues as me..

Here is what you need to do to get a custom web part to compile dynamical inside monox..

First.. just get the basic code up and running using the portal project that comes with monox.. make sure you move the solution files to the root of your monox and make sure your running visual studio as a administrator or else you may have some off upgrade issues and visual studio may report problems detecting the version of the portal solution..

I set the solution properties to something more my liking..
Assemble Name = Scene.Web
Namespace = Scene.Web

Once.. you pass this problem.. now its time to create a simple folder to hold your webpart..
just right click on the portal solution and create a folder.. call it something.. in my example I called my folder CusScene..

Now right click on the folder and add a new item - custom web user control.. I named my control WebPart.. Ok.. now you can code some stuff your self or just copy and past the following code into the controls.

WebPart.Ascx - Main Design - Source HTML
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebPart.ascx.cs" Inherits="Scene.Web.CusScene.WebPart" %>
<p>
    Name? 
    <asp:TextBox ID="TxtName" runat="server"></asp:TextBox>
    <asp:Button ID="CmdGO" runat="server" onclick="CmdGO_Click" Text="GO" />
</p>
<p>
    HELLO
    <asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>
</p>
<p>
     </p>


WebPart.ascx.cs

Note the most important part here.. is to make sure you inherit.. from monox..

MonoSoftware.MonoX.BaseAutoRegisterPart or something below this.

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MonoSoftware.MonoX;
 
namespace Scene.Web.CusScene
{
    public partial class WebPart : MonoSoftware.MonoX.BaseAutoRegisterPart
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void CmdGO_Click(object sender, EventArgs e)
        {
            lblName.Text = TxtName.Text;
        }
    }
}


WebPart.ascx.designer.cs - should be auto generated for you wehn you build the project.. but here the code anyways..

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
 
namespace Scene.Web.CusScene {
     
     
    public partial class WebPart {
         
        /// <summary>
        /// TxtName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox TxtName;
         
        /// <summary>
        /// CmdGO control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button CmdGO;
         
        /// <summary>
        /// lblName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblName;
    }
}



Once you compile the code.. you can not just move the control into the C:\Monox\MonoX\ModuleGallery - WebPart.ascx .. its good idea to change this some.. or use your own dir so you cant conflict with anything that monox has in its default gallery.. I plan to just put all my controls in their own folder... but for a quick test.. this worked just fine..

Once i have the part inside their.. i went into monox - logged into admin.. then put any page into design move.. and i could simply place my control anywhere inside monox..

presto!! this is exactly what I was trying to do.. now i can go wild and designing and building any custom control I need and simple allow my website users to drag and drop it into monox! woohoo..
This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

12/30/2010 6:11:32 PM
Hello, all

I am new to this framework.. I looked at some of the features and documentation but im still a bit iffy on how to customize it other then randomly guess on how to layout the api calls.

One of my concerns about using this produce is that i am looking to add a lot of my own customization screens and data fields..

So im trying to figure out how exactly I should start customizing this... do i need to write my own plug-ins since I dont have source code ?

Is there any examples online - tutorials on getting started to customize this system for custom needs ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

1/3/2011 11:32:31 AM
Hi,
There is a list of programming resources at [url=http://monox.mono-software.com/MonoX/Pages/AdditionalResources.aspx]http://monox.mono-software.com/MonoX/Pages/AdditionalResources.aspx[/url] that includes user's manual, API docs, books, articles and samples. MonoX is built upon Web Part infrastructure that is a standard feature of ASP.NET 2.0 and newer versions (SharePoint uses the same technology). If you have any experience with it, it will be rather easy to start using MonoX.

There is also a sample project in the installation MonoX/Samples/Solution folder that includes a minimal, ready to use VS solution with all references and other files. We will be happy to help you start your custom project.
This content has not been rated yet. 
7207 Reputation 956 Total posts
shawndg

shawndg

1/6/2011 3:49:12 PM
ok..

I found the projects but I cant open any of them in Visual Studio 2010 =/

Any solution to this ? or is there any started projects written in Visual Studio 2010 ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

1/6/2011 5:12:44 PM
You should be able to open the solutions in VS 2010. Did you follow the instructions from the Readme.txt? The important part is this: To start using the sample project you need to copy the "ProjectName.sln" and "Portal.csproj" to the root of the web application - it assumes that you already installed the MonoX on your machine.
If this doesn't help, could you please let us know what error message are you getting?
This content has not been rated yet. 
7207 Reputation 956 Total posts
shawndg

shawndg

1/8/2011 12:44:27 AM
Ok..

It turned out to be a issue with Visual Studio 2010- needed to run as admin or else it would error and say project can not be opened..

Ok.. now that i got it up and running.. im having another issue..

All the controls are saying - error Creating Controls.. Im not sure if this is normal or if there is something else I need to do..

The TagPrefix is not registered..
This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

2/15/2011 12:55:00 PM
Ok I managed to get the solution to work..

Now im trying to build a webpart.. and having some problems..

Im getting a error..
Error 2 The type or namespace name 'global_asax' does not exist in the namespace 'ASP' (are you missing an assembly reference?) C:\#devsite\TESTING\test.ascx 1 1 Portal


- I am trying to compile my own webpart..

So far I managed to create a directory inside the root/TESTING and then I added a new item to it.. c# web user control..

then I created the following files..

source to my testing.ascx form..
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="test.ascx.cs" Inherits="MonoSoftware.MonoX.CusScene.Testing" %>
<p>
your name: <asp:TextBox runat="server" ID="txtName" CssClass
="borderlessInput"></asp:TextBox> <asp:Button runat="server" ID="btnGo"
Text="OK" CssClass="SilverButton" OnClick="btnGo_Click" />
</p>
<p>
    Hello  
<asp:Label ID="lblName" runat="server"></asp:Label>
</p>


source to my test.ascx.cs file

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MonoSoftware.MonoX;
//using MonoSoftware.MonoX.Helpers;
 
namespace CusScene.Web.Test
{
    public partial class test : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
 
        protected void BtnGo_Click(object sender, EventArgs e)
        {
          //  lblName.Text = txtName.Text;
        }
 
    }
}


source to by test.ascx.designer.cs file

//------------------------------------------------------------------------------
 
namespace MonoSoftware.MonoX.CusScene {
     
     
    public partial class Testing {
         
        /// <summary>
        /// txtName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.TextBox txtName;
         
        /// <summary>
        /// btnGo control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Button btnGo;
         
        /// <summary>
        /// lblName control.
        /// </summary>
        /// <remarks>
        /// Auto-generated field.
        /// To modify move field declaration from designer file to code-behind file.
        /// </remarks>
        protected global::System.Web.UI.WebControls.Label lblName;
    }
}


I set project to compile.. but when i try.. I get the error above... am I doing this totally wrong and will anyone please shed some light on this.. I been kinda stuck inside the documentation regarding this..
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

1/8/2011 10:25:19 PM
Copy-pasted your code to the fresh install of the latest MonoX and it compiles without any problems in VS 2008. Upgraded the project and the site to VS 2010 / .NET 4 from Visual Studio conversion wizard. Worked flawlessly (had to set the .NET version manually on the application pool in the IIS manager, though).

Did you by any chance removed some of the files? Is there a PrecompiledApp.config in the root of MonoX? Is there a DLL called App_global.asax.dll in the /bin folder?
This content has not been rated yet. 
7207 Reputation 956 Total posts
shawndg

shawndg

1/9/2011 4:51:52 PM
when i have the build action set as content it works fine.. no errors..

but when i set the build action of the control to compile it starts producing a bunch of errors..

should i be setting it to compile or to content ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

1/9/2011 4:58:16 PM


Did you by any chance removed some of the files? Is there a PrecompiledApp.config in the root of MonoX? Is there a DLL called App_global.asax.dll in the /bin folder?



there is a precompiledapp.config file in the root of monox...
there is a dll called app_global.assax.dll in the bin directory of monox..

Is there some setting i am missing maybe in files ? i did not add a new project i just created a directory inside the sample monox project that comes with monox.. and added a web user control and set it to build action compile... and then coded from there..

am i doing something wrong ?
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

1/9/2011 6:35:26 PM
Everything should have the default settings: testing.ascx should have the build action set to content, and its codebehind (testing.ascx.cs) should have the build action set to compile.
Everything else looks OK, please confirm that you copied the sln and csproj files from the /MonoX/Samples/Solution folder to the root folder of your installation and opened it there?

If that doesn't help, let's try to solve this faster - please send us your MSN or Skype contact info to our support address (support at mono-software.com), and we will call you and go over your project settings to see what's wrong.
This content has not been rated yet. 
7207 Reputation 956 Total posts
1 2 3