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 create a custom UserControl in monox ?  (Mono Support )

Viewed 3227 time(s), 2 post(s) 5/7/2014 4:10:03 PMby super


5/7/2014 4:10:03 PM
I want to create a custom .ascx user control in monox.

I know how to do that in a standard application but I am getting error in monox as I need advise if I need to follow any guidelines ?

Here is that I have done so far.

1- Create a folder on root: "UserControl"

2- Added a new .ascx as "TestSqlUserControl.ascx"

3- Here is the .ascx code:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestSqlUserControl.ascx.cs" Inherits="MonoSoftware.MonoX.Pages.UserControl_TestSqlUserControl" %>
<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register Namespace="MonoSoftware.Web.Pager" Assembly="MonoSoftware.Web.Pager" TagPrefix="mono" %>

4- Here is code behind (TestSqlUserControl.ascx.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;
public partial class UserControl_TestSqlUserControl : BasePage
    protected void Page_Load(object sender, EventArgs e)

5- On the homepage I added this:

<%@ Register TagPrefix="MonoX" TagName="TestSqlUserControl" Src="/UserControl/TestSqlUserControl.ascx" %>
<MonoX:TestSqlUserControl runat="server"></MonoX:TestSqlUserControl>

Where I am wrong ? please advise ?

This content has not been rated yet. 
6018 Reputation 709 Total posts


5/8/2014 8:44:03 AM
Hello Super,
from what I can tell at first glance is that in your code behind class you are inheriting the BasePage class instead of one of the control classes (e.g. BasePagedPart).

Check for a tutorial how to build custom web parts.


This content has not been rated yet. 
345 Reputation 61 Total posts