-
-
well, after writing about it in several posts, I think
that all the issues I've mentioned are solve now. btw, you should know that if you don't define a global xml namespace, the AJAX extensions predefined namespace will be used by default.
-
-
During beta 1, we could easily load external scripts by adding a <script> element to the page, by using the ClientScriptManager and even by using the ScriptReference element in order to add references to external Javascript files. Beta 2 introduces some changes when you load a script file through a ScriptElement entry. The docs mention this briefly by saying the following:
"Component developers and page developers creating file-based script libraries that are registered
with the ScriptManager control should include a JavaScript code snippet that indicates that the
library has been downloaded by the client. Although this is not required in all browsers,
Safari requires this to be able to dynamically load scripts."
After talking with my good friend Garbin (thanks for pointing me in the right direction) and after running some tests, I'd say that this means is that now we must call the notifyScriptLoaded method exposed by the global Sys.Application object. To test this, let's build a simple page. We'll start by defining a Javascript file (test.js):
alert("howdy! I'm an external file" );
if( Sys && Sys.Application ){
Sys.Application.notifyScriptloaded();
}
Now, you must have noted the test for Sys and Sys.Application. Well, i've put it there since i'm lazy and I'd like to use my libraries in several web apps (which means that it has to run when i have a global Sys.Application object - which allways happens in an AJAX page - and when i don't). btw, i could have gone further and added a test for the method but, as I said, I'm lazy :)
Now, adding the file is really simple, like the following page shows:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="manager">
<Scripts>
<asp:ScriptReference Path="test.js" />
</Scripts>
</asp:ScriptManager>
</form>
</body>
</html>
Nothing to difficult, but still something that must be registered for future use.
-
-
I already had a post prepared on how to set the focus on a control after an async postback. Unfortunately, it went directly to "garbadge" since now it's all too easy: we can do that by using the new SetFocusmethod exposed by the ScriptManager class. Here's a demo page that does just that!
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void h(object sender, EventArgs e)
{
manager.SetFocus(info);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asP:Scriptmanager runat="server" id="manager" />
<asp:UpdatePanel runat="server" ID="panel">
<ContentTemplate>
<asp:TextBox runat="server" ID="info" />
<asp:Button runat="server" ID="bt" Text="focus" OnClick="h" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
-
-
I've just read it in JPC's blog (which is in Pt) that it's out!
-
-
Yes, the november release is out and you can get it from this page.