1

I want to create a view from scratch for a controller action ... what i want to put in the view i have saved it in the database as a table .... can i do that??? if yes anybody can help ...

This article i already went through this article i wanted to implement this without the ruby .so i am starting from scratch...

lucky
  • 65
  • 1
  • 1
  • 9

2 Answers2

2

You can create an empty view page. That is, a view page without any data in the BODY tag. Then have the controller get the body tag html from the database and send it to the empty view page. The view page will then include this html in the body tag.

<body>
<%= ViewData["MyBodyHTML"] %>
</body>

That should work.

Tony Borf
  • 4,579
  • 8
  • 43
  • 51
  • Yes, I currently use something like this. I can serve an entire HTML file from the database, and the view contains nothing more than <%= Model.Html %>. – Dan Atkinson Sep 11 '09 at 13:31
  • my question answered i figured something out like this after ur post thanks mate .. – lucky Sep 14 '09 at 04:14
0

I'm not sure if this is what you want but you could google MiniWiki.

They create pages on the fly on the file system but I imagine you could replace that bit of code with a page from a database.

Essentially they have a single page that contains a div that they replace the contents of with the new page.

They have a WikiPage object which contains all the properties that a page will require and they render that to the screen.

EDIT

I think you can find it here MiniWiki

Edit 2

Check this out Rendering a view on-the-fly

Don't forget to mark as correct answer if this is what you wanted.

Community
  • 1
  • 1
griegs
  • 22,624
  • 33
  • 128
  • 205
  • nope i wanted something where i can render a text box and all other stuffs also here only thing i can do is add sone text – lucky Sep 10 '09 at 05:56
  • My best (guess) in that case is that you'll need to take a look at the second link I provided and user IView.Render. – griegs Sep 10 '09 at 05:59