1

I have a page that I want to show 5 or 6 glimpses at other pages within the site.

For each of the subject pages, I have a field that has html in it...

I am curious about suggestions as the preview will be about 1/3 of the actual page size.... I don't want to have just the upper left of the page showing in the preview.

I thought about grabbing the first x characters and displaying that.... But, I end up with messed up html that throws the rest of the page off.

Can anybody tell me how they'd handle it? Can I render the html preview similar to an iframe? How can I do that in MVC.

Or, can I just strip the text from the HTML in a presentable way? I'd be ok with JUST the visible text of the html....

tereško
  • 58,060
  • 25
  • 98
  • 150
macecase
  • 147
  • 2
  • 12
  • I hope you have information about ajax and partialviews? – Gaurav Pandey Mar 14 '13 at 12:44
  • 1
    I would render the pages to images and display those (downsized). Look at this question http://stackoverflow.com/questions/8594504/rendering-asp-net-mvc-viewresult-html-as-image-without-third-party-components – polybios Mar 14 '13 at 12:49

2 Answers2

3

For display another page in ASP.NET MVC you can use the @HTML.Partial("MyViewPartial") (Html.Partial)

in your current page :

<section id="login">
    @Html.Partial("_MyViewPartial")   
</section>

And your partial view :

@{
      ViewBag.Title="MyViewPartial" 
      Layout=null;
 }
<h2> MyPartialView </h2>
Francois Borgies
  • 2,378
  • 31
  • 38
1

You could use the HttpClient Object to fetch a resource for you. (You can even parallelize the requests if you have 5 or 6 as the HttpClient will return a task). If you get the string representation of the resource you can pass that to your view, the browser would then take care of rendering the html, but it will be tricky to maintain the css.

Nick
  • 6,366
  • 5
  • 43
  • 62