Showing posts with label vs2005. Show all posts
Showing posts with label vs2005. Show all posts

Monday, March 26, 2012

How do I enable .NET 2.0 & AJAX 1.0 in VS2008?

I have to build some applications with VS2008 thatstill target .NET 2.0 and AJAX 1.0 (what we have been using in VS2005). I have created the new project as a .NET 2.0 project, but can't see how to enable AJAX 1.0.

How is this done please? Step by step instructions would be ideal.


Thanks in advance.

In VS 2008, we do not have a separate project type for AJAX Enabled Web site

All you have do is add the

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

from now on, you can start using the other AJAX server controls just like you did in AJAX 1.0 Extensions for ASP .NET 2.0


Right, I have to target .NET 2.0 because our web farms are going to stay .NET 2.0 for the forseeable future... and they also have AJAX 1.0 installed. So I need to make sure that I can build .NET 2.0/AJAX 1.0 compatible websites in VS2008... particularly I'll be building a basic template that my team can use to get up and running on VS2008 quickly.

Adding a Script Managerisn'tgoing to add the necessary components to my .NET 2.0 project so AJAX 1.0 runs without any other tweaking on my part- is it?

As I understand it, what you suggest would actually be using whatever the new version of AJAX is (instead of AJAX 1.0)... correct?


Well, in VS2008 we do not have a separate template for AJAX enabled web site. All you have do is drag and drop the AJAX controls to your page. Your website will work just fine even if only targetted to 2.0 framework


So when I deploy the VS2008 .NET 2.0/AJAX site to our .NET 2.0/AJAX 1.0 servers, there won't be an issue?? This is one of those things that I need to verify before I start pushing out new project templates, etc.


Well, this is what Microsoft is calling it as "Target Framework" as one of the key feature of VS 2008

I am using VS2008 Professional and tested the target framework feature and it is quite impressive. I only tested in my local machine though.

Hope this helps


I think the best way to do this:

- install, vs2005, asp.net ajax extensions 1.0, and finally vs2008

- create an ajax enabled web site/wap in vs2005 (or load your existing project if any)

- now open and convert the project in vs2008. Do not change the target framework, this ensures that your web.config and references remains compatible with the .net 2.0 + ajax 1.0 combo.

Maybe a new project (with 2.0 target) in a standalone vs2008 (no vs2005 installed) also works, I'm just wondering that in this case the project how to reference ajax 1.0?!


In doing some more experimentation, here's what I've figured out... sort of:

I converted copies of my old VS2005 web app templates to VS2008 (still targeting .NET 2.0). In fact, I didn't have to do anything special at all to get things to work. Just open the old Solution, tell it to convert, and bingo... things work. Of course this is a SIMPLE Master Pages based template, so nothing fancy going on that might cause trouble. ;)

The basic AJAX Extensions seem to run fine whether the project is targeting .NET 2.0 or 3.5.

I then installed the AJAX Controls for both AJAX 1.0 and the new 3.5 compatible version (two different tabs in the Toolbox in VS2008). When I have a 2.0 compatible project open, only the 2.0 Controls are available in the Toolbox (very smart!). So that makes it dead simple to use the right stuff in the right project(s).

Wanted to share this with the community - in the event someone else needs the help.


sound great. Please do not forget to mark the posts that helped you. By this way the thread will marked as answered.

How do I distinguish between AJAX postback and regular postback?

I just installed Ajax 1.0 with VS2005 SP1 and am trying to add AJAX to an existing site.


However, the site right now has fairly complex code in the master page defined in Page_init, Page_load, and PreRender events. I'd really like to skip those calls if it is an AJAX post back. I looked at the Page class and found IsCallBack and IsPostBack, both of which will not be triggered by an AJAX post back.

I thought of using a hidden variable (something like AJAXCall) and using a Javascript to set a value with every control that can trigger an AJAX postback, but that seems like not the right way to do it.

Does anyone know how to tell the difference between the two, or is it possible to skip Page_init, Page_load, and PreRender events with an AJAX call?

Thanks,

Ming

Yes you can, but you have to use UpdatePanel.

Girijesh:

Yes you can, but you have to use UpdatePanel.

I have tried the following setups with no success. In the master page, I included my script manager. Then I had an update panel with a button which updates a label with the system time. This takes about 10 seconds to update. The debugger tells me it executes Page_Load, Page_Init and PreRender.

Then I tried to include an update panel with a button inside page that inherits the master page, it also goes into all 3 methods. I tried this with my existing website, as well as a brand new AJAX enabled website.

Any ideas?

Thanks,


Ming


Hi Ming,
You can use ScriptManager.IsInAsyncPostBack property to distinguish them.
Hope this helps.

Raymond Wen - MSFT:

Hi Ming,
You can use ScriptManager.IsInAsyncPostBack property to distinguish them.
Hope this helps.

It worked like a charm. Thanks for telling me exactly what I was looking for.

Thanks!

Wednesday, March 21, 2012

How can I install the AJAX website template trough VS Orcas?

How can I install the AJAX website template trough VS Orcas?

It work with VS2005...

Thanks

Greg

AJAX functionality is default in Orcas. You can choose the normal website template.