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.

New Page  (Mono Support )

Viewed 12790 time(s), 8 post(s) 5/17/2014 1:26:28 AMby Samtg
Samtg

Samtg

5/17/2014 1:26:28 AM
Hi,
     I am trying to create a new page, and I keep getting an error that says:
"Only Content controls are allowed directly in a content page that contains Content controls."
I was trying to modify the page to get it to show, but could not do so.

Also, is there a way using a MonoX Web Part to dynamically create a new page?
Thanks.
This content has not been rated yet. 
440 Reputation 38 Total posts
Dalibor

Dalibor

5/20/2014 2:45:48 PM
Hello Samtg,

Can you please tell me which version of MonoX are you using? Are you adding the new page through "Files" or "Pages" section?

Please provide more details on what type of functionality should this generated page have.

Thank you and best regards,
Dalibor
This content has not been rated yet. 
250 Reputation 19 Total posts
Samtg

Samtg

5/22/2014 1:21:10 AM
Hi,
     Yeah, I think I am using version 4.8.40.4598, version with Pages in it.  I actually had two questions.  I am trying to create my own page through the Pages section on the Administration panel, and I have also been trying to code it different ways, but have unsuccessful, and I get the error above.

Second question, is that I am trying to get the user to generate a page, dynamically, however, without going to any administration panel, through using something like ckeditor.

Thanks.
This content has not been rated yet. 
440 Reputation 38 Total posts
khorvat

khorvat

5/25/2014 2:07:48 PM
Hi,

"I am trying to create my own page through the Pages section on the Administration panel, and I have also been trying to code it different ways, but have unsuccessful, and I get the error above.
In order to dynamically add a new page you have to go to MonoX administation -> Page admin -> and on the right side you need to right click on the file list and add a new page based on available templates. If you are creating the page manually then you should use the standard ASP.NET approach and just use the MonoX master page in order to get the Web Part zone management functionality.

Programatically creating a MonoX page

1.string templateFile = "PathToTemplateFileyouWantToUse";
2.string newFilePath = "PathAndNewFileName";
3.FileUtility.FreeFileCopy(templateFile, newFilePath, string.Format("({0}) {1}", Directory.GetParent(templateFile).Parent.Name, FileUtility.GetFileOrFolderName(templateFile).Replace(".aspx", string.Empty, StringComparison.InvariantCultureIgnoreCase)));
4.//instantiate page so everything could be written in the database - for example, all DocumentEntities are created in the database if a page contains HtmlEditors
5.PageEntity selectedPage = DependencyInjectionFactory.Resolve<IPageBLL>().GetPage(FileUtility.PhysicalPathToUrl(newFilePath), Request.QueryString[ApplicationSettings.LocalizationSubFolder]);
6.WebClient client = new WebClient();
7.client.DownloadString(String.Format("{0}/{1}", ApplicationSettings.BaseSiteFullUrl, selectedPage.Url.Replace("/", "")));
Note: This is MonoX 5.1 based code

Regards

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

Samtg

6/18/2014 3:46:34 PM
Hi Khorvat,
     I was unsuccessful in my attempt to create a new page.  For the code above, would there be any changes for version 4.8.40.4598, where would that code go (I assume on the .aspx page that you want it), and how the instantiation of the page would tie in with that.
Thanks for any help.
This content has not been rated yet. 
440 Reputation 38 Total posts
mzilic

mzilic

6/20/2014 4:55:01 PM
Hello,

Yes there would be a few changes for 4.8.xx version, you should only resolve dependency injection references in the code snippet.

Regards,
Mario
This content has not been rated yet. 
2218 Reputation 300 Total posts
Samtg

Samtg

6/23/2014 10:21:48 PM
What would the code look like when you get rid of the dependency injection references?  Also, would you recommend upgrading to version 5?  Also, what would the page instantiation look like; would it need to be an html editor from MonoX to add it to the database, or would another editor (such as ckeditor) or something else add it to the database?
Thanks.
This content has not been rated yet. 
440 Reputation 38 Total posts
khorvat

khorvat

6/24/2014 9:15:03 AM
Hi,

to resolve the DI references you just need to put the e.g. "new PageBLL()" line instead of the "DependencyInjectionFactory.Resolve<IPageBLL>". If you plan onto moving to v5 you will have to fix few breaking changes and some of them are already listed on the forums and some of them will be published on the blog. So it's up to you and your schedule if you can upgrade to v5 or not, but if you do you will be able to easily do v5 upgrades containing bug fixes etc.

"Also, what would the page instantiation look like; would it need to be an html editor from MonoX to add it to the database, or would another editor (such as ckeditor) or something else add it to the database?"
I have provided you with the code that is used for page instantiation so you should use that, but don't mix the page objects with document objects (document objects are related to UI editors while page is just a container for WebParts etc.) . You can use the ckeditor but you have to implement this on your own.

Regards
Rated 5.00, 2 vote(s). 
15993 Reputation 2214 Total posts