Using AJAX in monodevelop - asp.net

So I have been searching the web extensively for how to use the AJAX toolkit in mono ASP.
so far what I have gathered is that you need to add System.Web.Extensions
to your references. But for some odd reason I cannot use it in my WebForms site
<asp:ScriptManager> simply doesn't exists so can someone tell me what I have missed?
I'm using mono version 3.0.4.6

you need System.Web.Extensions if you like combine ajax calls and callbacks. But you don't need it if you use jQuery instead of ajax toolkit.
And monodevelop is only for edit the aspx or the js files and run xsp to do the test.
XSP will respond ok to the jquery calls

Related

how can i user razor syntax in asp.net project not mvc [duplicate]

I'm liking the Razor syntax that Microsoft has developed for inline coding in their WebMatrix product (http://en.wikipedia.org/wiki/Microsoft_WebMatrix).
Now that Visual Studio SP1 has RTM'd, is it possible (and/or planned) to enable the use of Razor syntax in ASP.NET Webforms?
We (the ASP.NET team) currently have no plans to support the WebForms page model using Razor syntax. Furthermore it is unlikely that we would ever seriously consider this as the models are too different to make the two work together.
You can use Razor pages without MVC; this is called ASP.Net WebPages.
Just add .CSHTML files to a normal ASP.Net 4.0 project.
I explained how this works in my blog.
You could possibly integrate it using the RazorEngine available from Codeplex. It allows you to process razor outside of MVC. Though you don't get all the features you get from the MVC version of Razor, such as #Html and #Url and others.
I dare say that Microsoft have considered it, but there is no official word on the subject. Since you are not supposed to have C# or VB code in the ASPX file, you have to wonder about the point of adding Razor support to Web Forms. The code behind would still be a (partial) class file. You wouldn't put Razor there any more than you would put it in a class file in Web Pages or MVC. And swapping Server Controls and all that good declarative stuff for Html Helpers removes one of the key reasons for going the Web Forms route, IMO.
This really isn't that difficult to do. Working on it right now. Grab RazorEngine from CodePlex. It lets you compile Razor cshtml/vbhtml files into a class at runtime.
You can then take that class, and use it from a ASP.Net server control, inside its Render method. This is a great way to get HTML out of the body of a server control. Much, much cleaner.
Now, you can also add some methods that you can invoke from Razor. For instance, add something like RenderChild. Additionally, you could set the Server Control itself as the Model available to Razor. You could then invoke into the server control. Including doing something like grabbing one of it's child controls and invoking Render.

Creating an AJAX-Enabled Web Site

I'am trying to follow an ASP.NET with AJAX Training. At certain moment, they deploy an AJAX-Enabled Web Site. but for me I can't found this option (I'm using Visual Studio 2008).
Even if I installed the Ajax Control Toolkit it still not working for me !!
What must I do to find this ?
Even if you can't find the template, you can still do everything the training kit needs.
The only difference between an ASP.NET web project and an AJAX-enabled ASP.NET web project is that it takes care of a few pre-requisites for you:
1) It adds a reference to the Ajax control toolkit. You can do this manually by right-clicking on your project in the Solution Explorer, choosing "Add Reference", and navigating to the AjaxControlToolkit DLL (or find it in under the .NET tab, if you've added it to the GAC).
2) It adds a ScriptManager control to your aspx page. It comes with the Ajax Control Toolkit. The ScriptManager is required to use any of the AJAX Control Toolkit controls. Add it to the top of your page.
If you take care of those two things, you should be good to go - it's the same thing as using the Ajax-enabled website template.
I have an issue in 2nd step. As i am using update panel and there is already a ScriptManager in master page, so I am using ScriptManagerProxy in updatepanel.
So when i start adding "ToolkitScriptManager" it shows error "Two scriptmanager" instances are not possible in one page...
Manish Jain

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.

How would you go about using the ASP.NET AJAX Control Toolkit in a project that doesn't use ASP.NET on the back end

Your backend could be PHP or Python but you want to use the controls from the ASP.NET toolkit is there a successful way to do this?
I don't think that it is possible.
The ASP.NET AJAX Toolkit is based on ASP.NET technique (what a surprise) and needs ASP.NET.
It contains server-side controls, which are translated to HTML and Javascript by the ASP.NET engine. It is not working without the engine.
However you can check the code itself to see how it is working, what it generates on the browser side and get ideas and Javascript codes to build into your application or framework.
Edit: I've just found an interesting project, which is in alpha stage, check this out.
Why do you want to use the ASP.NET AJAX Toolkit with PHP / Python?
Have you considered other non ASP.NET specific AJAX libraries like jQuery, Dojo, MooTools, YUI?
ASP.NET AJAX and the ASP.NET AJAX Toolkit is ASP.NET centric, you'll gain more flexibility using other AJAX libraries with PHP / Python.
are you talking about the ASP.NET AJAX Control Toolkit?
Have a look at this blogpost on Stephen Walther's blog:
ASP.NET MVC Tip #36 – Create a Popup Calendar Helper
In this post he shows how to use the 'script only' version of the AJAX Control Toolkit. This version of the AJAX Control Toolkit does not contain server-side controls or control extenders. It contains only the client-side files – JavaScript, CSS, images – required to use the client-side AJAX behaviors.
Stephen Walther is a Senior Program Manager at Microsoft who is responsible for ASP.NET MVC content and community (his job title is ASP.NET MVC Ninja).
I have found that much of the functionality in AJAX Control Toolkit can be accomplished via the javascript frameworks such as jQuery.

Resources