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 )

7693 put(a) pogledan, 2 odgovor(a) 7.5.2014. 16:10:03Kreirao(la) super
super

super

7.5.2014. 16:10:03
I want to create a custom .ascx user control in monox.

I know how to do that in a standard asp.net 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" %>
<h1>
    Test
 
</h1>

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 ?

Ovaj sadržaj još nije ocijenjen. 
6018 Reputacija 709 Ukupno objava
vzakanj

vzakanj

8.5.2014. 8:44:03
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 http://www.mono-software.com/Blog/post/Mono/93/Building-a-custom-Web-part/ for a tutorial how to build custom web parts.

Regards,
Vedran

Ovaj sadržaj još nije ocijenjen. 
345 Reputacija 61 Ukupno objava