How to call one of the editors in a custom module/page?

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
1/9/2011 7:11:56 PM
Gravatar
Total Posts 137
When enough isn't

How to call one of the editors in a custom module/page?

Hi

We have users doing their own text updates to some pretty advanced custom modules and pages to cover more than 7000 sport clubs. In those custom modules the users will have to add/change/update text plus track history, which ends up in our MySql database just like content from the Html modules.

But I don't know how and if you can call one of the standard MojoPortal editors like CKeditor? The standard asp.net input fields are very limited in functionality and we can't educate so many users in html-coding the text.

How do you place such an editor in your asp.net code on the custom pages?

Thanks,

Lars

1/10/2011 2:00:52 AM
Gravatar
Total Posts 550

Re: How to call one of the editors in a custom module/page?

Hi Lars,

You can use the following control in your .aspx file:

<mpe:EditorControl ID="edDescription" runat="server">
</mpe:EditorControl>

And in the code behind do the following :

protected override void OnPreInit(EventArgs e)
{
.

.

SiteUtils.SetupEditor(edDescription);.

.
.
}

 

Hope helps

Asad

1/10/2011 4:55:31 AM
Gravatar
Total Posts 137
When enough isn't

Re: How to call one of the editors in a custom module/page?

Thanks Asad,

That looks interesting. After some test I'm able to put in a nice editor panel on my page. But how do I then bind it to a text or note field that I want to edit.

This is how my code looks now, which is placed deeply inside an edit template in a listview:

<asp:TextBox ID="TextBoxMyText" runat="server" Width="497px"
Text='<%# Bind("MyText") %>' TextMode="MultiLine" Rows="15" />

I very happy for your help,
Lars

1/10/2011 5:54:08 AM
Gravatar
Total Posts 550

Re: How to call one of the editors in a custom module/page?

Hi Lars ,

It seems you don't use included editor (i. e CKEditor, ...) and use an traditional text box that I think you should correct your code as following:

<asp:TextBox ID="TextBoxMyText" runat="server" Width="497px"
Text='<%# Eval("MyText") %>' TextMode="MultiLine" Rows="15" />

Hope Helps

Asad

1/10/2011 6:17:27 AM
Gravatar
Total Posts 137
When enough isn't

Re: How to call one of the editors in a custom module/page?

No, the whole idea is that I want to change to use i.e. CKEditor instead of a text box. I just don't know how to bind it to my specific field, which is comming from a datasource to the listview.

Some of my more specific questions are:

- Do I create some kind of popup-panel inside the listview edit template where I can call the editor and bind to my field?

- Do I place the mpe:EditorControl code inside the listview, inside/before a popup-panel or right in the beginning of my page outside the listview?

- Do I have to use something else than listview + textbox to use an editorcontrol?

Sorry for all the questions and the lack of my skills - maybe you have a good example I can learn from? I can do some limited c# code in scripts on my page, but I can not do a lot of code-behind files. I'm also pretty stucked to use ADO.net datasources and asp.net to bind to my MySql database.

Thanks a lot for taking your time ...

Best regards,
Lars

 

1/10/2011 6:55:41 AM
Gravatar
Total Posts 18439

Re: How to call one of the editors in a custom module/page?

I don't think the editors are going to work inside a list view, you might be able to use the editor included in the ajaxcontrol toolkit but the other editors have to be wired up from javascript in ways that is difficult inside a list control. In mojoPortal we typically don't do that, we use a separate page to edit things and just link to it from lists and pass in the needed ids for whatever is being edited.

mojoPortal source code is full of example code you can study to learn how to do things by looking at the code for features that already do similar things to what you are trying to accomplish.

This thread is not really about Site Administration, future questions about development should be posted in the Developer forum.

Best,

Joe

 

1/10/2011 8:06:14 AM
Gravatar
Total Posts 137
When enough isn't

Re: How to call one of the editors in a custom module/page?

Fantastic - the Ajax Control Toolkit was the magic word for me. I have never used it before, but taking the control toolkit from mojoportal into my development bin-folder gave me the tools and then in 5 seconds I had it up running inside my current listview edit template. So that was fantastic!!

Even though this showed out to not being a MojoPortal specific question I thank you both a lot for your help. You pushed me on in the right direction and I'm very thankful.

Lars

You must sign in to post in the forums. This thread is closed to new posts.