I am working on redesigning and streamlining the checkout process for an Ecommerce website using ASP.NET/C# into 1 page. (Currently, the website doesn't use any ASP controls)
Just for a little back info, the customer will be able to enter a shipping address, add a gift message, and select a shipping date per recipient while updating the backend with the correct information. I want this process to be elegant and pain free for customers to use.
Now I have created WebMethods that get called through AJAX requests that work correctly on previous features.
My question is:
Would it be an ok idea to submit ALL these requests through WebMethod AJAX calls, have it update the backend, and render the correct information to the user?
I know it is doable but I just want to be sure that this is an ok approach to take. I have been looking at other JavaScript frame works that might help but am too unfamiliar with them to know if they would work or not.
Please let me know what you think and if you have other suggestions.
Thank you!
Short answer: Yes.
You mentioned:
an Ecommerce website using ASP.NET/C# into 1 page
If that is true, then you are talking about a single page web app. There are a couple of references to single page web apps here:
https://msdn.microsoft.com/en-us/magazine/dn463786.aspx
https://en.wikipedia.org/wiki/Single-page_application
It's very common to do what you are talking about. Using AJAX to perform back-end processes and then update small pieces of the front end is key to making fluid, fast, and responsive web applications. That's mainly because smaller pieces of data are being sent through the network, and the UI is being updated in smaller segments. If architected correctly, single page web apps can provide a slick, intuitive web experience for clients and customers. Emphasis on "If architected correctly". So make sure to do your research.
There are several libraries out there that can help you, such as:
jQuery
jQueryUI
Bootstrap
Angularjs
Sencha ExtJs
Backbone
Knockout
You don't have to use them, but they can save you a lot of time. At the very least, I would recommend using jQuery. Do some research and find out which one(s) will work best to fit your specific application.
I don't see any problem in this approach, the good part about ajax WebMethod is that you will transfer only the important data to do the operation. its better and fast than use a updatePanel
We use a lot of ajax webMethod in our asp.net project and we never got problems with it :)
A good advice is looking for asp.net mvc, its better than asp.net web forms
Related
I have ASP.NET 4 Web Application that connects with SQL SERVER 2005/2008
I want to add a "chat" feature to my application users.
Supposing the feature will be built from scratch, what's the best efficient reasonable approach:
Using WCF web services with a Javascript timer every 3 seconds
Using ASMX web services with a javascript timer every 3 seconds
Using AJAX control from ASP.NET (Update Panel) and do a partial Post Back depending on an ASP.NET timer (server side) every 3 seconds.
Sending requests from the database to the application telling him to refresh himself when a new message is there (I don't have an idea about this approach but I think the technology exists, but I don't even know its name)
Some JQuery AJAX technologies that are outside Microsoft AJAX .NET Framework. these technologies should be able to communicate with SQL Server and be compatible with ASP.NET (Not PHP). I'm not sure about this approach.
Any other approaches or opinions.
Supposing the feature will be built depending on a previously implemented library. what are possible libraries that are totally customized and so likely to be open source. If the library will save 25% of the work time so that will be great, but I can't use a hidden code (blind DLL) if it's pretty critical even if it saves 80% of the work time.
Thanks,
You should look at SignalR - which is pretty good and less configuration required for it.
SignalR Project - http://signalr.net/
SignalR, Simple Implementation - http://rizwanahmed.net/?p=227
If you have more questions let me know...
Thanks,
Riz
We are looking into a better way to deliver data update notifications to a web front end.
These notifications trigger events that execute business logic and up-date elements via JavaScript (JS) to dynamically update the page without reloading.
Currently this is done with a server side thread, which timely fires an A-synch JS event to notify the web front-end(s) to check if the data has been changed or not.
This mechanism works, but the feeling within the team is that it could be a lot more efficient.
The tool is written in C# / ASP.NET combined with JS and we use the PokeIn library for the aSynch JS/C# Calls.
Any suggestions for improved functionality are welcome! Including radically different approaches still maintaining the JS/C#/ASP.NET usage.
Is this a real question? I would like to add this as a comment but I don't have the enough score.. Anyway, if you need what pokein does for you (object translation among the parties) that is the only option you have. Although there are solutions like websync, signalr.. They don't handle the object translation and has no different approach etc... Better, you benefit from pokein's websocket feature. Both of others needs Windows Server 8 for websocket. Pokein lets you use websocket on any server version or platform..
Sounds like SignalR would help you? This blog post gives a good introduction.
I was trying to solve something similar (reporting real-time updates triggered from an external services communicating with the server) recently and it turned out SignalR is a perfect fit for this situation.
Basically it is a library wrapping long-polling, Web Sockets and few other techniques, using (transparently) whatever is available on server and client.
I only have good experience with it so far.
I am learning how to create a website using ASP.NET & C#. Right now I am learning making AJAX requests & outputting the response. I have lots of experience with websites & using python/php server side & javascript + html client side.
Whats the best practice method to perform AJAX requests in an ASP.NET website? Is it JQuery or C#/ASP.NET?
Is it better practice to use native C#/ASP.NET AJAX calls/code?
// I think its something like
<asp:AJAX ....>
Does it matter which method is used?
Are you able to give a simple example in ASP.NET of how to write an AJAX request/call? I know how to do it in JQuery & also native Javascript but not in ASP.NET.
Since you're asking this question, you probably realize that there are a few different ways of doing things. Unfortunately, with so many different options you have to actually make a choice, which can be difficult.
There is no 'proper' way to use AJAX with your ASP.net site, as they all have their pros and cons. It all about what will be the easiest for you (and any team members) to write, read, and maintain.
There are several controls built specifically to use AJAX (by using a ScriptManager control on the page that imports all kinds of useful JS). Things like the UpdatePanel can help make AJAX-y partial-postback things on a page really simple to write and maintain. There are also tons of other neat controls in the AJAX Control ToolKit that give you even more pre-built controls to use.
If you're looking for a more 'traditional' AJAX experience, you can make life easy by using PageMethods. You can also look into things like Web Services (kind of deprecated, but you'll still find them all over the place, and WCF services to make things as painless as possible. These can be called via your code-behind, asp, or jquery/js.
So, in short, just as with everything else in web development, there is no 'right way', just the right was for you.
In ASP.NET, AJAX is utilzed by UpdatePanel control.
See these resources:
http://www.asp.net/ajaxlibrary/act.ashx
http://www.asp.net/ajaxlibrary/act_tutorials.ashx
i need to update client on any changes occurred on server.
for that i found 2 approach.
1. using ajax which is also known as reverse ajax for this purpose.
2. using COMET.
but i don't know exact difference in both.
my site contains news content and i want that news to be automatically updates when new news is entered by my CMS application.
i have got hundreds of concurrent users on my web application.
please suggest me which approach should i use to get best solution.
also please provide me good example's like for that so that i can implement it.
NOTE: i am using .net framework 2.0 but if its not possible in 2.0 then can also move to 3.5
Thanks.
First start with YAGNI principle. See if it is ok for your client to update periodically, lets say every min or every 30 seconds. Consider things like how much information users can process in this interval. Also take a look at popular news site and how they implement this feature. In this case you are better off using the pull model where your client updates itself by requesting data from server. Implementing a push model is much more complicated.
Once you are sure that you need the push model, IMO comet is a better option. Coment is designed for this purpose. Dojo Foundation's CometD is a widely used library for this purpose. One good example is the live chess application on chess.com
Also, though I am not 100% sure about this, I believe you will need to use technologies like ASP.NET MVC which will allow you more control on the markup generated by your web app so that you can use these libraries.
I keep hearing that the server side ASP .NET AJAX controls (like UpdatePanels) are not truly AJAX though they seem like it, because rendering is not completely on the client side. I'm trying to understand this with more clarity. Could someone elaborate?
Thanks...
UpdatePanels came out fairly early in the AJAX cycle, and they're heavy (they can emit around 100-300k of JavaScript). Behind the scenes, UpdatePanels post the entire page back to the server via a JavaScript XMLHttpRequest. The new page is generated with the normal page lifecycle just like a postback, but only the parts that live inside the UpdatePanel (plus the parts necessary for updating ViewState and so on) are sent back to the client. From there, the markup is inserted without a visible flash or interruption of page state.
Most competing AJAX tools lean towards super lightweight implementations that let you ship or generate a small chunk of HTML via Javascript, and I would say that's the dominant direction today, especially outside the ASP.NET world.
The difference in total amount of data sent across the wire is huge -- see the link below. In low-traffic situations it might not make a bit of difference, but in the case of a site like StackOverflow, it would show up on the bandwidth bill for sure.
All that said, I don't think it's fair to say that UpdatePanels are not actually AJAX, since they do ship HTML around via asynch JavaScript -- it's just that there's a gigantic, often cumbersome framework on top. UpdatePanels get a bad rap sometimes, but they provide a brilliantly simple developer experience. I've often found them useful in low-traffic situations.
Update: Here is an article (old but still valid) that examines the payload UpdatePanels ship to and from the server. It also goes into Page Methods, which is a lightweight, Web Service-based alternative to UpdatePanels. This is an oft-overlooked part of Microsoft AJAX.
http://msdn.microsoft.com/en-us/magazine/cc163480.aspx
Maybe this will answer???
I hope. (Reading it as well).
Seems to me that the Control is a Server Side object that uses ajax as a mechanism and that the ajax is rendered to do the client side. In this sense It isn't pure ajax but, rather a blending of multiple solutions.
:)