This project is read-only.

How can new content be created without using Dashboard

Topics: General
Jul 22, 2011 at 10:25 PM

Suppose type Discussion contains type DiscussionPost.  One can always use the Dasshboard to add a DiscussionPost. Can a link or button be added to Discussion page that opens the new DiscussionPost window?  

Jul 23, 2011 at 12:44 AM

Sure. Html.ActionLink should help.

Jul 23, 2011 at 2:16 PM

I added @Html.ActionLink(...) in the HTML code of the body part, but it does not recognize it as code. It simply wraps it with <p></p> and displays @Html.ActionLink(...) without creating the link.

I am sure I am missing something rudimentary.  Could you offer a quick tip on this?

Jul 23, 2011 at 3:04 PM

For now, I am using the following to do the job:

<a href="Admin/Contents/Create/DiscussionPost">Creat a new discussion topic</a> 

I would still love to know how to use ActionLink to do this.  It may be a better option.

Jul 25, 2011 at 9:19 PM

Wow wow wow, you mean you want to just put that code into the body, from the admin UI? No no no, that is not how it's done, you need to go into the appropriate template file (cshtml) and add that code there. The admin UI is for creating content, not to add new behavior.

Jul 27, 2011 at 4:38 PM

Thanks. In this case, I will stick with <a>. I assume modifications of template files will be eliminated when upgrading Orchard with a new version.

Jul 27, 2011 at 9:17 PM

Not if you override them from your own theme (which is what you should be doing).