I am trying to determine the best way to do this.
Basically, I have a child app that runs inside of a parent app in IIS. I want to be able to run this app inside of the parent app (using the same layout and functionality)
What is my my best bet for doing this? Running the app in an iFrame? Loading the app through jQuery into a div? Or should I create a web service that sends the parent app's layout to the child app?
Any guidance is appreciated.
What you are talking about here is composition. There are a whole bunch of different composition patterns you can apply which will each have pros and cons. Stack overflow isnt really a great place to get an answer on what the 'best' pattern to use is but here are a few I can think of:
Server side composition patterns
Shared Layout file with MVC
This method uses a layout file from a DLL shared by both sites to render all pages
Its pretty easy to implement but means you need to release both sites when the file changes
This encourages strong coupling between the sites (which is bad)
Sub request based rendering
Only have a parent site on the internet, at run time request blocks of content from an internal url for the child site
Loose coupling in terms of content but strong coupling in terms of urls
many child sites can be pulled in and are not coupled to each other
parent/child sites can be released independently
Client side composition
IFrames
really lo-fi, so easy to implement
has a bunch of really aweful stuff to deal with in terms of css and javascript between the frame and parent
Generally considered by devs as a bad idea (opinion)
Coupling only by URLs, sites can be released independantly
Ajax in content
Do an ajax request for components from other sites as the page loads
Increases page load times and gives ui flicker as bits load in
Pretty easy to implement and manage
Coupling only by URLs, sites can be released independantly
You could either use Area on your app, iFrame, or simply open a new browser tab for your child app.
If you want to include your project in a dll, you could compile all the views into a dll and reference it with your parent app, this web site explains how this can be done.
I would recommend you to use the way to make empty layout of your child application and render it to the div of your parent application with JQuery. IFrame should stay in the past.
Related
Is there a way to create a sticky music player, like soundcloud so that when you browse from one page to another on your site your music keeps playing without being interrupted with a postback?
You need single page application for that, you cannot stop the player from interrupting when reloading the whole page.
As I'm looking for the exact same solution, I can tell you: It's not possible without making your whole website using AJAX technology.
So you have to modify your whole page in a way, that the basic HTML construction is always open, and all internal links opens within the AJAX controlled containers.
There is no and probably will be no other way.
One service that does that is bandzoogle.com as you can see in one of their pages here: camilameza.com
When you inspect their code, you can see, that all interaction within the site is within one single container which switches the content.
Good luck!
I'm building a basic web application in ASP.NET 4.0 with C# in Visual Studio 2010 Pro. I'm still very new to C#, and am used to Delphi coding. My website already has registration/login, and although I use some asp.net controls, a majority of my pages are dynamically loaded from my SQL database and I manually compile the HTML code from C# and insert it into the document.
Now what I would like to do is implement a poll - or a vote box - an 'object' which can be re-used in different pages. My website's master page already has a permanent left panel which has things which show on every page. One of these will be a small box with a vote of a few questions.
All I need to know is how do I begin to build an independent plugin control for a web page like this? I don't necessarily mean a separate DLL or anything, my existing one can handle everything. But I'd like to re-use the same little voting box in different pages too. So I'm assuming this will be considered a separate page, in a way, which is probably about 120 pixels wide by 80 high. Each vote will be limited to either login account or ip address (which I already have access to). So this solution must interact with the existing asp.net application.
So how do I begin the 'backbone' of such a plugin which can be re-used in multiple pages? I do not plan on distributing this plugin, and I don't even know if this is the correct term for what I need. Just a 'box' which can be 're-used' on multiple pages - which must interact with the asp.net app.
To better explain what I mean, imagine how Facebook has the plugin where you can embed some general info about likes and such. I'd like to make my own box like this - and even be able to embed it in other websites.
It sounds like you just need to make the poll into a user control. The documentation should get you started with them. A control can access everything an ASP.NET page can when it comes to the login information. It won't handle embedding into other pages though – embeddable active content that authenticates against your site is a nontrivial problem.
As I said in the comment, if most of your HTML is creates as a blob that's opaque to ASP.NET, it will probably be nontrivial to insert a user control into the middle of it.
Using which of these is the best approach while planning Silverlight application? UserControls or Page.
My understanding is that when you have to encapsulate some of the logic of some component, which is truly generic and reusable then use usercontrol else use Page because Page is tightly integrated with browser's history etc, so you can move back and forth and can make use of NavigationService to navigate across pages because if you keep using usercontrols, it is very tiresome to navigate all the way to the required page. Thus we cannot bookmark it because it serves no purpose. We will have to again find our way through the menus in application to reach our desired location.
Is my understanding correct?
Your understanding is correct. Use Pages to integrate with the Navigation framework and the main pages and controls for custom components etc.
I have a pretty big web application that I created last year using ASP.NET webforms. It has two parts: Admin and Client (each one a project inside a single solution). Admin logs in as you would expect and manages the clients. Clients log in and manage themselves. SQL Server back end. It relies heavily on MasterPages and LINQ. It has 2 class libraries, one for my methods (authentication, security, encryption, etc.) and another with dbml files for linq that both admin and client project reference.
Now I really want to convert this to MVC 2. I know I'll have to rewrite the front end (not a problem, looking forward to it). I can reference my current class libraries and modify them as I need. My main concerns are my forms and controls. I'd really like to stay away from the major asp controls and use jquery for everything if possible (especially the presentation layer. I'm just not sure how to go about doing this. I was also told jquery is great for 'parsing and updating the DOM' but I've never done this either and not sure where to start (why do this over LINQ?).
Another issue I struggled with was the size of my main table. It has 109 fields in it, and my customer thinks all of them need to be available on screen (or as many as possible, especially in the grid). I had to break up my entry/edit form into 5 tabs (all web controls). My grids have sorting, grouping, export to excel, etc... I would really like to find a grid that lets you inline edit individual cells when double clicked. Would it be better to use jquery for grids? I can break that large table into relational tables if needed (probably will do that anyway).
Any advice from anyone who's done similar will be greatly appreciated. I just bought the book "Pro ASP.NET MVC 2 Framework, Second Edition" and I have a great jQuery ebook I'm working with.
Thank you guys!
EDIT: Should have mentioned I used Telerik WebControls for my previous web forms project so I'm familiar with them. I had no idea their MVC suite was free (I've paid quite a bit for the webform controls).
For grids I can recommend the free Telerik mvc controls. They have good support for ajax binding paging, sort, edit, parent-child etc.
This combined with a few widgets from jQuery ui (tabs, dialog) should put you on the right track as far as your presentation layer is concerned.
Adding to RedSquare, the Telerik Extensions for ASP.NET MVC are free and open source (under GPLv2). That essentially means the Extensions for free for "free" projects (projects you're not trying to sell). If you're trying to sell and make money from your software, we have a commercial license, too, to support that.
Today, the Extensions for MVC include 8 extensions: Grid, Calendar, DatePicker, Menu, NumericTextBox, PanelBar, TabStrip, and TreeView.
Additionally, 3 new Extensions are available in beta: Editor, ComboBox, and Window. (Official release towards the end of August.)
The goal of the Extensions is to make it easier to build rich MVC Views, similar to what you've done in the past in WebForms. MVC is very different than WebForms, though, so be careful when making the transition to avoid the "traps" of thinking in WebForms mode. For example, there are no PostBacks or ViewState in MVC, so some things require more deliberate code in MVC.
Finally, as a word of caution for "pure" JavaScript components, remember that they do not support any scenario where JavaScript is disable or not executed (common examples: web crawlers, accessible browsers). If accessibility or SEO are concerns, Server + Client UI controls like the Telerik Extensions can be a bonus.
Hope that helps.
Im a c# developer and I believe that what I want to achieve is going to move out of the realms of some drop in .NET component so I am looking for advise on what I use externally which .NET can inter op with.
My requirements are to have an embedded web browser control in a WPF/Winforms applciation BUT I will also need to keep track of the following:
User interaction i.e. what pages they visit, forms submitted where they click etc.
DOM manipulation and traversing
I am guessing here but it seems that I might need to start looking at open source html/web browsers out there like WebKit etc. Is this the right track or is there anything currently available in the form of a control/COM object that I can use directly.
Cheers, Chris.
You should be able to accomplish point 1 using the webbrowser control in Visual Studio, but I dont think DOM manipulation is available, i do know you can traverse all the tags.
reference