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 )

14446 put(a) pogledan, 8 odgovor(a) 17.5.2014. 1:26:28Kreirao(la) Samtg
Samtg

Samtg

17.5.2014. 1:26:28
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.
Ovaj sadržaj još nije ocijenjen. 
440 Reputacija 38 Ukupno objava
Dalibor

Dalibor

20.5.2014. 14:45:48
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
Ovaj sadržaj još nije ocijenjen. 
250 Reputacija 19 Ukupno objava
Samtg

Samtg

22.5.2014. 1:21:10
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.
Ovaj sadržaj još nije ocijenjen. 
440 Reputacija 38 Ukupno objava
khorvat

khorvat

25.5.2014. 14:07:48
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

Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
Samtg

Samtg

18.6.2014. 15:46:34
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.
Ovaj sadržaj još nije ocijenjen. 
440 Reputacija 38 Ukupno objava
mzilic

mzilic

20.6.2014. 16:55:01
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
Ovaj sadržaj još nije ocijenjen. 
2218 Reputacija 300 Ukupno objava
Samtg

Samtg

23.6.2014. 22:21:48
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.
Ovaj sadržaj još nije ocijenjen. 
440 Reputacija 38 Ukupno objava
khorvat

khorvat

24.6.2014. 9:15:03
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
Ocjena 5,00, 2 glas(ova). 
15993 Reputacija 2214 Ukupno objava