Ajax based Dashboard On LargeData - asp.net

I am working on some sort of CRM application which has huge sales data with all the customer leads etc (ASP.NET 2.0/Ajax)
I want to create a dashboard which will have four separate data containers each container will have different sort of data and each container has to update it self after some configured time interval. so I want to update only that part of page not whole page
What should I used in the above scenario asp.net updatePanel or jQuery implementation (which technique and why)
Because performance is also important here.

Both ASP.NET UpdatePanel or jQuery (or a mix of both) would serve you fine on this scenario; if you don't have experience with neither, I would recommend the UpdatePanel way because it is closer to the regular ASP.NET code you're used to.
This article will get you 90% there, all you have to do at the end is to put some simple javascript in place to fire the updates every X seconds; something like window.setTimeout("Button1.click()",5000) if you want to refresh a panel every 5 seconds. If you don't want the button to be available for the users, just make it hidden via CSS.
There are more elegant approaches (using JSON, webservices, client-side templating etc) but that's an easy way to get the job done.

ASP.NET UpdatePanel is easy to set up, but in my experience terrible to debug.
Doing it yourself with jQuery (or some other JS framework) and an .NET AJAX library is more work upfront, but much easier to improve and maintain later.
UpdatePanel's traffic is a lot bigger than the JSON you'd use with your own solution, if that's a concern.

Also you can use dynamic dashboard framework and convert update panels to drag-drop widgets.
It's a browser independent web part framework for Asp.Net.

Related

How to keep DRY a Ajax web forms solution

At the moment we have a solution which is Web forms ASP.Net 4.0. We do a number of things such as using web methods and services either calling them using the standard web forms way or sometimes to reduce the footprint directly calling them with jQuery ajax posts and gets.
We are looking to improve the way we work but we have heavy constricts regarding how the solution is at the moment and not being able to completely rewrite it.
Updating the page using Ajaxs for data, forms and for example pulling "the next 20" items and displaying them on the page it what I would like to heavily stream line.
Using template's due as PURE and jQuery Templates is fantastic way to produce fast calls back and forth between the servers but results in having two copies of the html. (the template for the jQuery and the code in the actual first render of the page)
We have thought about possible producing a empty template and then always populating it via json data we post down to the server but I feel this isn't how things should be done...
can anyone reckoned the best way we can do this without having two copies of our 'template' (e.g. a row of a table)
You mean you have a template in asp and the same template in javascript, but you'd rather just have 1 or the other?
I think that is really subjective. It is always different based on use case. That being said I'd do it by modifying my views and templates. My views (non-js) would simply have containers for that dynamic content. In other words I'd never load the dynamic portions of content into the views initially. Rather, on page load I would simply load up the template and the json that fills it in.
If you think about it that's 2 more requests, but it makes your life easier. The user also is able to see something on the page sooner.
This is one of those questions that really depends on what you are doing. There are trade-offs to be analyzed with every solution.

ASP.NET Client vs Server View Rendering

Using ASP.NET MVC: I am caught in the middle between rendering my views on the server vs in the client (say jquery templates). I do not like the idea of mixing the two as I hear some people say. For example, some have said they will render the initial page (say a list of a bunch of comments) server side, and then when a new comment is added they use client side templating. The requirement to have the same rendering logic in two different areas of your code makes me wonder how people convince themselves it is worth it.
What are the reasons you use to decide which to use where?
How does your argument change when using ASP.NET Web Forms?
One reason that people do that is because they want their sites to get indexed by search engines but also want to have the best user experience, so are writing client code for that. You have to decide what makes sense given the constraints and goals you have. Unfortunately, what makes the most business sense won't always seem to make the most sense from a technical perspective.
One advantage to server-side rendering is that your clients don't have to use javascript in order for your pages to be functional. If you're relying on JQuery templates, you pretty much have to assume that your page won't have any content when rendered without javascript. For some people this is important.
As you say, I would prefer not to use the same rendering logic twice, since you run the risk of letting it get out of sync.
I generally prefer to just leverage partial views to generate most content server-side. Pages with straight HTML tend to render a bit faster than pages that have to be "built" after they've loaded, making the initial load a little speedier.
We've developed an event-based AJAX architecture for our application which allows us to generate a piece of content in response to the result of an action, and essentially send back any number of commands to the client-side code to say "Use the results of this rendered partial view to replace the element with ID 'X'", or "Open a new modal popup dialog with this as the content." This is beneficial because the server-side code can have a lot more control over the results of an AJAX request, without having to write client-side code to handle every contingency for every action.
On the other hand, putting the server in control like this means that the request has to return before the client-side knows what to do. If your view rendering was largely client-based, you could make something "happen" in the UI (like inserting the new comment where it goes) immediately, thereby improving the "perceived speed" of your site. Also, the internet connection is generally the real speed bottleneck of most websites, so just having less data (JSON) to send over the wire can often make things more speedy. So for elements that I want to respond very smoothly to user interaction, I often use client-side rendering.
In the past, search-engine optimization was a big issue here as well, as Jarrett Widman says. But my understanding is that most modern search engines are smart enough to evaluate the initial javascript for pages they visit, and figure out what the page would actually look like after it loads. Google even recommends the use of the "shebang" in your URLs to help them know how to index pages that are dynamically loaded by AJAX.

What's the effective technology to use for a slick UI in an ASP.NET application?

We are planning to extend an existing ASP.NET application (a real huge one) to have a slicker UI. One of the requiremnents is to have a way to execute server side code without a postback (As an example, say a user clicks on a link or hovers on a link, a popup comes up which executes server side code or makes calls to the database)
We plan to add more functionality that closely aligns with the behavior of a yahoo or a google customized page.
Is UpdatePanels a way to go or should a lot of it be implemented using JavaScript? One of the main requirements is to keep the pages as light as possible and to have good performance. We don't plan on using any 3rd party components.
What technologies are suggested that will help us add UI heavy features in the future?
Edit: Thanks everyone. It appears that the approach to take is to use a JS library such as JQuery and AJAX (from initial research the PageMethod/WebMethod way of doing it)?
Any more suggestions?
I think that UpdatePanels are actually pretty clunky. (Actually, I think ASP.NET is pretty clunky now that I've moved to ASP.NET MVC). If the page is going to be highly interactive, I'd suggest using some sort of javascript framework, like jQuery, Dojo, MooTools, etc. that will allow you to do AJAX easily as well as manage the user experience client-side. MS is distributing jQuery with Visual Studio and has promised to support it, so you might want to consider that when making your decision.
Stephen Walter did a great talk about the next version of ASP.NET Ajax 4.0. It's not an immediate solution but it's interesting to see where Microsoft is going with their Ajax framework.
There's a lot more to ASP.NET AJAX than the UpdatePanel, and a fair amount of it can be done without heavy JavaScript work. UpdatePanel is quite inefficient in terms of the amount of data send over the wire. As with everything, only optimise when you need - but bear in mind that the UpdatePanel is one of the first places to look for your slowdowns.
Just to give you a different answer than everybody else: why not try silverlight?

Tips for developing an ASP.NET application that doesn't depend on JavaScript

Not sure if this belongs in community wiki...
Can somebody give some general guidelines on how to successfully build an ASP.NET site that isn't dependent on JavaScript? My understanding is that I should build a functional site initially without JavaScript, and use it to enhance the user experience. That is easier said than done... how can I make sure my site works without JavaScript short of disabling JavaScript and trying it? Or is this something that comes with experience?
Try ASP.NET MVC! sure most of the examples use JavaScript for the AJAX functionality, but it's easy to build a fully functioning site that doesn't use JavaScript.
Since ASP.NET MVC doesn't use server controls with all their embedded JavaScript, it's a great way to build a site with very minimal and lightweight HTML, while still writting your data access and business logic in C#, VB.NET, or any other .NET language.
I've built working ASP.Net sites with little or no JavaScript, so it's definitely possible (just a royal pain.) The trick, and this sounds silly, is to use as few <ASP:> type tags as possible. Those all spawn various levels of JavaScript. Regular old-school HTML elements work just fine with no scripting.
So, on the extreme end, you write, say, your form using all plain-vanilla HTML elements, and then you have that form submit point at another page that accepts the form submit and hands it off to your server-side scripting.
To put it another way, pretend that all you get with ASP.NET is a snazzy server-side programming language and you're writing HTML in 1998.
Now, having done this, I can tell you that what this ends up as is a classic ASP webpage with cleaner programming syntax. ;) Most of the features that make ASP.NET "better" than classic ASP hang on JavaScript, so writing a JavaScript-free ASP.NET system is an exercise in shooting oneself in the foot repeatedly.
However, the one thing you should absolutely do is make sure the first page or two do work without JavaScript. Unlike 10 years ago you can safely assume that any browser hitting your page has JavaScript, and unlike about 8 years ago, your visitors probably don't have JavaScript turned off for speed reasons, but they very well might have something like the NoScript plugin for Firefox dialed all the way to 11. So, your first couple of pages need to work well enough to a) tell the new visitor that they need JavaScript, and b) still look and work good enough to make it look like adding your site to the white list is worth it. (In my experience, most people get the first one done, but in such as way as to totally drop the ball on the second. To put it another way - if your super fancy web 2.0 mega site starts looking like craigslist if noScript is fired up, I'm probably not going to bother letting you run scripts on my machine.)
If you want to use many of the ASP.NET controls (i.e. the DataGridView), ASP.NET pages are generated with lots of JavaScript in order to handle the events on the controls (i.e. selecting a row in the DataGridView). I think you're going to lose so much of ASP.NET that trying to have ASP.NET work without JavaScript enabled is impractical.
Disabling Javascript is the best way to test how a web site performs with out it. Good news, IE8's developer tools provide a quick and easy way to do just that. Now, having said that, often times the only thing that you can do is put up a message with a noscript tag to the effect that your site requires javascript for best function.
Many ASP.NET functionalities & controls won't work when JavaScript has been disabled. Think of LinkButton's onclick event which contains a call to a JavaScript function.
LinkButton is just an example. But there are many other things too.
If your concern is with JavaScript being disabled in user's browser then you can check for that and handle your site accordingly.
If you do decide to build the site without JavaScript then you will end up building a somewhat static web site. If your need is just to build a static website then you can go on with this approach.
Write everything with basic html forms and css, and then you will know that it works without javascript.
Once you are happy with it, then look at unobtrusive javascript, so you can modify the way the application works when javascript is enabled.
Last time I looked at some stats about this around 1% disable JavaScript, so why spend hours and hours on this when what you should do is show a message telling the user that your site requires javascript.
Use your time to be productive instead of trying to write around perceived limitations.

AJAX form editing and design

I want to build into mt ASP.NET application the ability for users to fill up forms, but the forms are not something I can hard-code into my (Enterprise) software.
So I need one screen that lets end users create the forms. Doing it the 2.0 way, I just love what PollDaddy did in their survey editor (great job guys!). How do I replicate that? (don't worry pollDaddy, my app has nothing to do with survey and I am not at all in your domain (-: )
Since you need to login to the site to play with it, I made a 20 sec video of how it looks like. Please see below and tell me how to best replicate this (as simple as using JQuery tip? use an entire open source project? Buy something?)
Requirements are:
support multiple types of elements (like multiple choice, free text, comboBox)
drag and drop
editing of order
click image for video or here
http://frame.revver.com/frame/120x90/1376799.jpg
The AJAX control toolkit is free and would work for some of this items shown in the video. However, JQuery has tons of plugins it is easy to extend and even easier to use. I would suggest starting there and extending it where needed.
Good Luck
You could build it yourself using an AJAX framework like ASP.NET AJAX or even telerik controls. You could use jQuery but ASP.NET AJAX is free and embeds well with ASP.NET pages. You could buy something, but I've yet to encounter packages as such.

Resources