Using google webtoolkit with ASP.NET - asp.net

I have a page rendered in asp.net. Now I want to use google web toolkit to interact with this page. Is it possible..

Yes.
Since GWT is simply compiled down to Javascript, you can use it with any server-side language. You will use the GWT Ajax methods to communicate with your backend.

When working with non-java technology on the server side, you probably should use JSON RPC to communicate with your logic on the server side.

Related

Does PhoneGap go hand-in-hand with ASP.Net webforms?

I'm new to PhoneGap and everywhere I looked doesn't suggest anything about using webforms as server code.
The application server is normally a web server (Apache, IIS, etc...) and has a server side scripting language such as ColdFusion, Java, .NET, PHP, etc... PhoneGap is agnostic of back-end technologies and can work with any application server using standard web protocols. The application server performs business logic and calculations, and generally retrieves or persists data from a separate data repository - this is normally a relational database, but could be any structure or mechanism for data persistence.
http://phonegap.com/2012/05/02/phonegap-explained-visually/
This article however, mentioned that PhoneGap is able to work with just about any application server including .Net.
Has anyone used PhoneGap with webform before? Do they work?
What about the form postbacks etc? Or everything should be AJAX-based? (Calling webmethods etc)
From the end of the linked article:
PhoneGap applications generally do not talk directly to a database;
communication is routed through an application server. The client
to application server communication can be based upon standard HTTP
requests for HTML content, REST-ful XML services, JSON services, or
SOAP (or websockets if your OS supports it). These are the exact same
techniques that you would use in a desktop-browser based AJAX)
application.
The client-side architecture generally uses the single-page
application model, where the application logic is inside a single HTML
page. This page is never unloaded from memory. All data will be
displayed by updating the HTML DOM, data is retrieved from the
application server using AJAX techniques, and variables are kept
in-memory within JavaScript.
So yes, in general you wouldn't use postbacks, you would use Ajax calls back to the server in order to get/create/update data - which is supported by asp.net webforms via handlers (ashx) or even static page methods on an aspx page. Your actual front-end you just design in HTML and CSS, no asp.net controls, just plain old html inputs, etc.

Why I have both javascript code in .aspx file and c# codes in .cs file?

I'm currently working on an ASP.Net web application. Just curious when I noticed that I have both javascript codes and C# codes. Is it possible to transfer all my javascript codes to c# codes to make it looks more consistent? Thanks!
No. JavaScript code executes on the Client Side. C# executes on the Server Side. They perform two different functions and can't be treated interchangeably.
C# is your server-side, back-end logic to support your web page. The JavaScript is client-side code running in the browser, often to improve the user experience and perform some logic or UI operations wihtout having to go to the server.
Javascript is a language that executes on the Browser, on the Client Side; C# code is executed on the web server.

Is the ASP.NET Ajax Library dead?

I've recently stumbled across a few blogs that say the ASP.NET Ajax Library is dead, in particular:
http://encosia.com/2010/10/04/understanding-jquerys-impact-on-microsoft-and-asp-net/
http://weblogs.asp.net/toddanglin/archive/2010/04/19/microsoft-ajax-client-library-is-dead-long-live-jquery.aspx
Is this generally true, technically and practically?
I've been to Microsoft talks on jQuery, and basically it sounded to me like they expected everyone to use jQuery for client-side-only DOM manipulation and ASP.NET Ajax was still used for it's Ajax components (like UpdatePanel) and as a basis for AJAX into .NET services made with WCF or just back to ASHX or other server code.
From being a component developer that targets ASP.NET, I can tell you that it's very much used by our customers, and we need to support it.
Yes, it is. Even for SharePoint developers (which uses ASP.net AJAX heavily) it's out of favor.
However, the SERVER SIDE ASP.net AJAX (UpdatePanel etc.) are alive and kicking. They have some shortcomings (UpdatePanel can send tons of viewstate back and forth).
But the Client Side Framework and ASP.net AJAX Library is dead.
Scalable comet ajax is more popular now. Try the samples of PokeIn library.
A technology can't die if it's customer base is so big!

Any way to use ASP.NET AJAX when my server does not and can not have the ASP.NET AJAX extensions Installed?

I have a server with .Net 2.0 sp1 installed and have no ability to install the AJAX extensions on the server.
Is there anyway I could work around this to incorporate ASP.NET AJAX functionality?
You don't need to install the AJAX extensions into the server's GAC.
You can locally reference System.Web.Extensions.dll from your applications BIN folder....I've done it half a dozen times.
Copy that DLL to your projects local bin. Reference it from your project. Remember to deploy the DLL when you deploy, and you are set.
Theres always prototype and jQuery for AJAX calls.
Both of which are perfectly valid for making Ajax calls to the server, despite Jonathan Hollands persistence (and his down-voting of everyone else's response) to the contrary.
MS now packages jQuery with Visual Studio, so there is no interoperability problem.
Please remember that the server has no knowledge of controls created on the client side, and you will have to take the extra steps to persist any data (via ajax calls) to the server.
If you can't install AJAX extensions, you will have to manage the AJAX calls yourself. It's absolutely possible, since AJAX Extensions just wrap the meat of AJAX. Read up on XMLHttpRequest and you'll find many examples.
Here's a good site with examples.
http://www.fiftyfoureleven.com/resources/programming/xmlhttprequest/examples
Note that most of AJAX is done on the client side (in the browser) in Javascript.
While there are some server-side libraries to make responding to a AJAX query easier, for the most part they are unnecessary. Any server technology that can server a web page to a browser can handle an AJAX request just as well.
Microsoft ASP.NET AJAX is not the only way to implement AJAX Functionality. jQuery and Prototype are two popular javascript libraries for working with AJAX, regardless of server platform.
If you're tied 100% to Microsoft ASP.NET AJAX, then you may need to download it and install the DLL manually to your local project.

Using jQuery in ASP.NET

When using the AJAX functionality in jQuery, do I also have to have ASP.NET AJAX/.NET 3.5 installed also? or can I only use ASP.NET AJAX?
I'm unclear on whether or not I'm able to use AJAX in ASP.NET without ASP.NET AJAX or not.
No, you don't need ASP.NET AJAX installed to use the AJAX functionality of jQuery.
You can call PageMethods and Web Services without needing a ScriptManager control (which generates the JavaScript proxy objects that allow you to use familiar syntax to call web services and page methods).
Article on using jQuery to directly call ASP.NET AJAX page methods
Article on using jQuery to Consume ASP.NET JSON Web Services
Let me first clarify the use of jQuery. jQuery is simply a javascript library, and it has nothing to to with ASP.NET or any other server side platform such as PHP or JSP.
So you can simply use jQuery side by side with ASP.NET, or even combine jQuery with ASP.NET 3.5 that has AJAX built in.
You can also use jQuery's AJAX if you like, and it still can run in ASP.NET. If you want to combine both, please test your aspx page first if you also want to use ASP.NET's UpdatePanel with jQuery's AJAX, since it can bring incompatibilities between them.
No, if you're using jQuery you don't need ASP.NET AJAX installed.
ASP.NET Ajax is not needed in order to use jQuery, but the two work well together, hence the support from Microsoft.

Resources