Showing posts with label elements. Show all posts
Showing posts with label elements. Show all posts

Wednesday, March 28, 2012

ASP.Net Ajax elements not being recognized

I've just installed ASP.Net Ajax beta 2 and added its references to web.config, but my project still gives me some errors (my project was originally created using ASP.Net Ajax beta 1 template).

Here they are:

Warning 1 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 7 206 c:\...\n2_lc1\
Warning 2 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 8 200 c:\...\n2_lc1\
Warning 3 The 'requirePermission' attribute is not declared. c:\Inetpub\wwwroot\n2_lc1\Web.config 9 214 c:\...\n2_lc1\
Error 28 Element 'ScriptManager' is not a known element. This can occur if there is a compilation error in the Web site. c:\Inetpub\wwwroot\n2_lc1\processo\acompanhamento_corrida.aspx 32 7 c:\...\n2_lc1\

What can I do?

When I create a new project it works. With existing projects it doesn't work.

Try to take a look at this reading when upgrading to Ajax Beta 2 -
????http://66.102.7.104/search?q=cache:6kV1ivEIoIYJ:ajax.asp.net/files/Migration%2520Guide.doc+Upgrade+Ajax+Migration&hl=en&ct=clnk&cd=1
????http://ajax.asp.net/files/AspNet_AJAX_CTP_to_Beta_Whitepaper.aspx
Wish the above can give you some helps.

Jasson, thanks for your reply, but the problem isn't migrating an Atlas to Ajax code. The problem I have is about the prefix ASP for Ajax controls that Visual Studio Intellisense is not recognizing.

Visual Studio marks the Ajax elements as unknown. Their elements only work if I change Ajax prefix to another one (different from ASP).


Sorry for not giving you an immediate reply.For your questions, try to follow up the following suggestions.

Do you have the following code line when you want to access Ajax control toolkit? This is necessary to refer to Ajax control toolkit in your website project. If not,try to add it

Wednesday, March 21, 2012

Are there any onAvailable or onContentReady events for DOM elements?

Hello,

I am wondering if the client side classes provide a way to check when an element is available and/or when an element is complete (has all content). I know that this type of functionality is present in the Yahoo UI library and would like to have it in the MS Ajax library.

Thanks!

I was looking for this as well, so I figured others might be too. This is what I came up with.

It utilizes the Dean Edwards solution.http://dean.edwards.name/weblog/2006/06/again/

<script type="text/javascript" language="javascript">function Sys$_Application$add_ready(handler) { var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); if (e) throw e; /*********************************************** * Borrowed from Dean Edwards solution: http://dean.edwards.name/weblog/2006/06/again/ * - slight modifications that include Atlas features. ***********************************************/ var init = function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); handler(); }; /* for Mozilla/Opera9 */ if(Sys.Browser.agent == Sys.Browser.Opera || Sys.Browser.agent == Sys.Browser.Firefox) { document.addEventListener("DOMContentLoaded", init, false); } /* for Internet Explorer */ else if(Sys.Browser.agent == Sys.Browser.InternetExplorer) { document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); var script = document.getElementById("__ie_onload"); script.onreadystatechange = function() { if (this.readyState == "complete") { init(); } }; } /* for Safari */ else if(Sys.Browser.agent == Sys.Browser.Safari) { var _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { init(); } }, 10); } else { this.get_events().addHandler("load", init); }} Sys._Application.prototype.add_ready = Sys$_Application$add_ready</script>

I might be missing something, but what I think the first guy was asking for was a way to tell if a particular element on the page (e.g. a given <span> tag) has been rendered and has content, where your solution seems to just replicate what agax exposes through the pageLoad() function... am I wrong?
I might be missing something, but what I think the first guy was asking for was a way to tell if a particular element on the page (e.g. a given <span> tag) has been rendered and has content, where your solution seems to just replicate what asp.net ajax exposes through the pageLoad() function... am I wrong?
Here's a link to what she was asking for. It's slightly different than the onload event.

http://developer.yahoo.com/yui/event/#onavailable
Ok, so what she was askign for is what I thought she was asking for; what I'm not understanding is how your example script does it. It looks like it notifies when the app loads, not when a given element loads. That's the part I'm not following.

The event is triggered when the DOM is actually available, which happens before the onload event. If you go to http://dean.edwards.name/weblog/2006/06/again/ it will make much more sense. This is essentially what YUI, jQuery, and other javascript libraries are doing for the onContentReady event. As far as the onAvailable event, that's a different story.


I was looking at my original code and made some modifications. Most specifically you can know have multiple add_ready events.

<script language="javascript" type="text/javascript">function Sys$_Application$add_ready(f) { var e = Function._validateParams(arguments, [{name: "handler", type: Function}]); if (e) throw e; /*********************************************** * Borrowed from Dean Edwards solution: http://dean.edwards.name/weblog/2006/06/again/ * - slight modifications to include Atlas features. ***********************************************/ var init = function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); f(); }; readyList = this.get_events(); /* for Mozilla/Opera9 */ if(Sys.Browser.agent == Sys.Browser.Opera || Sys.Browser.agent == Sys.Browser.Firefox) { document.addEventListener("DOMContentLoaded", init, false); } /* for Internet Explorer */ else if(Sys.Browser.agent == Sys.Browser.InternetExplorer) { document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>"); readyList.addHandler("readystatechange", init); $get("__ie_onload").onreadystatechange = function() { if (this.readyState == "complete") { readyList.getHandler("readystatechange")(this, Sys.EventArgs.Empty); } } } /* for Safari */ else if(Sys.Browser.agent == Sys.Browser.Safari) { readyList.addHandler("readystatechange", init); var _timer = setInterval(function() { if (/loaded|complete/.test(document.readyState)) { readyList.getHandler("readystatechange")(this, Sys.EventArgs.Empty); } }, 10); } /* for All others */ else { this.get_events().addHandler("load", init); }} Sys._Application.prototype.add_ready = Sys$_Application$add_ready;</script>