Stack Me
Stack Me

Reputation: 31

How to create view page dynamically in asp.net mvc3

I am working on a classified ads project using mvc. This is my first project in mvc, so I am facing problems to build a small CMS.

In this website scenario is this:

  1. User will create a page and this will be created dynamically and this page will be its home page.
  2. This page contents like (header, menu bar, footer etc.) will be create dynamically.
  3. User can add more pages like about us or contact us. As you would with www.wordpress.com.

I am using tye word dynamically to mean generated by c# or any other method

So I am confused how to create these pages and how to save and manage css, html of these pages.

Please help me with any books or articles (I searched a lot but I did not find a solution)

I don't want to use any CMS Tool (it is a client's requirement)

Upvotes: 0

Views: 2022

Answers (4)

Romias
Romias

Reputation: 14133

ORCHARD CMS - it is developed on ASP.NET MVC. May be you can use this CMS as your base and just develope the exact extension you need.

Upvotes: 1

Brian White
Brian White

Reputation: 1314

You aren't going to create cshtml pages dynamically. That sounds like a fundamental misconception. I'm new to .net mvc, so my code examples may be off. But I've done many CMSs. One View will be the "render stuff from database" view, I'll call it RenderStuff. You would define a lot of different sections there, so your master layout page can @RenderSection("header"), and your RenderStuff view would do:

@section header {
  //query db for header row based on customer and pageid
  //if found, write out as html
}

You will probably want to set up routing so that you always have two route parameters of customer and page id:

context.MapRoute(
                "Stuff_default",
                "Stuff/{controller}/{action}/{customer}/{pageid}"}
            );

There's a lot more to a CMS.

Upvotes: 0

Iridio
Iridio

Reputation: 9271

I'm not aware of any books specific on developing a CMS from scratch.

Other than the good books already listed in the answers of Travis J, I can suggest you to look at Umbraco. It's a CMS and you can download the sources.

I strongly suggest you to first read at least one between ProfessionaL ASP.NET MVC 3 and Pro ASP.NET MVC 3 Framework before diving in Umbraco sources.

Upvotes: 1

Related Questions