Showing posts with label ctp. Show all posts
Showing posts with label ctp. Show all posts

Wednesday, March 28, 2012

Ajax Beta V.1: Strange behaviour with treeview inside the update panel (Again!)

I have a treevew control ( with dynamically created nodes) that was working great with July CTP. The control no longer works with beta any more:

1. Does not maintain the expanded state during ajax post back ( the nodes expand collapse unexpectly).

2. Strange behaviour if nodes are dynamically populated. This bug was present with the earlier atlas CTP's but was fixed with July CTP.

I have to use the same work around referenced in post:http://forums.asp.net/thread/1203662.aspx

------------------------

Similar issue, I didn’t want the tree to update always. The workaround that I am using is ,

Put tree in update panel (with conditional update).

- Add "TreeNodePopulate" event as a trigger in your update panel

- Turn off the client behaviour of tree expand ( putPopulateNodesFromClient = false ) and let atlas take care of it.

- Use Populate on demand = true.

-------------------------

Is any body else is having similar problem?

You might want to look at the CSS Adapters Beta 3 - they have what appears to be a 'ajaxified' treeview control that does not do full postbacks and retains viewstate on the client side... However, warning... if you do not need the other adaptewrs do not install them in your project as they override everything automatically and there is no method I know of to not allow the adapters controls it targets dynamically or explicitly...

The cool thing though is they provide all the source for it - so it may mean you can at least write an custom extender control for treeview that will integrate nicely with ajax...

Just a suggestion - and as usual unsure if I ever know what I am talking about...

AJAX Beta 1.0 - Odd Behaviour of AutoCompleteExtender

Moving to Beta 1.0 has not been a trivial task. I've been using AutoCompleteExtender for a while now and it was working quite well with the CTP. Upgrade to AJAX Beta 1.0 and everything stops working, and this is WITH the Value-Add CTP included as well.

Here is what I ran into:

My webservice method was never being called. I spent 3 hours on trying to figure out why my complex form wasn't calling the webservice when I'd put in a value. Turns out that with the CTP the parameter names on the web method didn't matter, but theyDO matter in beta 1.0.

Originally I had the following signature:

Public Function GetCustomers(ByVal prefixTextAs String,ByVal maxCountAs Integer)As String()
I then switched this this method signature and everything started working:
Public Function GetCustomers(ByVal prefixTextAs String,ByVal countAs Integer)As String()

I then went back and fixed all of my other autocompletes, but one still doesn't work. If you try and use the AutoComplete within a gridview control (I'm trying to let my user add rows by providing a row at the bottom with fields), the control never gets registered for autocomplete.

This used to work in the Atlas CTP. I've tried everything I can think of but no luck fixing this one.

Last thing, when a form has an AutoCompleteExtender and I click on a asp:hyperlink I get an exception thrown by WebResource.axd in the following code:

Sys.UI.DomElement.getVisible = function Sys$UI$DomElement$getVisible(element) {/// <param name="element" type="Sys.UI.DomElement"></param> /// <returns type="Boolean"></returns> var e = Function._validateParams(arguments, [ {name:"element", type: Sys.UI.DomElement} ]);if (e)throw e;return (element.style.visibility !=='hidden');}
The exception thrown is:
Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: element

All in all this has been a pretty frustrating upgrade. The CTP had been working so well for so long that I felt like moving to the Ajax Beta would be a safe proposition...
Charles

Another bugs:

I have AutoCompleteExtender in Wizard control on 3rd step. When I load a page, Javascript error occurs:
1if (!type.inheritsFrom(Sys.Component)) {
2 throw Error.argument('type', String.format(Sys.Res.createNotComponent, type.getName()));
3 }
4if (type.inheritsFrom(Sys.UI.Behavior) || type.inheritsFrom(Sys.UI.Control)) {
5 if (!element) throw Error.argument('element', Sys.Res.createNoDom);
6 }
on line 6 (i code it is line 1960):
Sys.ArgumentException: Value must not be null for Control and Behaviors.
Parameter name: element

I really don't know what to do with it


For us it has been the same. However, changing parameters names does not do the trick...

Can you please provide a short fragement of an ASP page with an AutoComplete that actually works with the new value added package?

Thanks,

J


I am also havin the same problem.I have uninstalled Atlas,installed the Asp.net Ajax and theJuly CTP .I recreated the project with Autocomplete extender but the webservice method is never being called and there are also no errors.

Guimauve, I would appreciate if u can post a sample code on how you made the extender call the webservice method?

Thanks,

PSK


The javascript errors are pretty annoying. Hopefully it wont be long for beta 2 (or beta 1.1?).:-) It is a shame that the CTP was going so well that it feels like a step backwards but they won't have made these changes for nothing and remember we are rather early adopters! If we shouldn't use beta's for production code then CTP is even more risky :-)

For the AutoCompleteExtender make sure your web service has the ScriptService tag as not having it fails silently. E.G:

[Microsoft.Web.Script.Services.ScriptService]
[WebService(Namespace =http://tempuri.org/)]
[WebServiceBinding(ConformsTo =WsiProfiles.BasicProfile1_1)]


Hi, i have de same Exception (description = "Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: element")in WebResource.axd (function Sys$UI$DomElement$getVisible(element)).But my Webservice (or ScriptService) is working fine. I fink the Control is working fine. Everything looks ok, but after Postback (some Applications still need it), pug!Dave
There is a a thread with a sample posted on issue regdin AutoCompleteextenderhttp://forums.asp.net/thread/1437583.aspxIts the same as thx 1137 pointed out

AJAX Beta 1 and PageMethods Error

Hello,
I'm using the PageMethods to call page methods. All works with the ATLAS CTP.
With the new AJAX Beta 1 I have an error: PageMethods is undefined. I don't think it's a problem of my web.config. If i create a new ASP.NET AJAX Enabled Web Site I have the same error.

Someone have the same error? Is it a bug? Is it a beta 1 change?

Thanks,
Alessadro

hello.

make sure that your page method is public and STATIC (this is a change from the previous ctp version). btw, make sure that the method receives all the values that it needs to perform its calculations since now you don't get access to the controls maintained on the page.


I have checked all this things before posting.
My methods are public and static and have the attributes Microsoft.Web.Script.Services.ScriptMethod and WebMethod.
They use only local variables and don't access any page controls.

I think that the error is different: PageMethods is undefined. I have this javascript error, so I don't think it's a problem with my methods. It's the PageMethods that is not defined.
If i define a simple method that return an integer, I have the same error. And I have the same error if i create a new ASP.NET AJAX Enabled web site project too.


hello again.

if i recall correctly, you just need to use the webmethod. here's a quick example i have here:

<%@. Page Language="C#" %>
<%@. Import namespace="LivroAtlas"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
[System.Web.Services.WebMethod]
public static Aluno[] ObtemAlunos()
{
Aluno[] alunos = new Aluno[]{
new Aluno( "João", 15 ),
new Aluno( "Rita", 16 ),
};

return alunos;
}
</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" />
<input type="button" value="invocar método da página" onclick="handle()" />
</form>
<script type="text/javascript">
function handle()
{
PageMethods.ObtemAlunos( handleCallback);
}
function handleCallback( res )
{
for( var i = 0; i < res.length; i++ )
{
alert( res[i].Nome + "-" + res[i].Idade );
}
}
</script>
</body>
</html>

btw, if you check the source of your page and don't see the global variable PageMethods, then that means that the ScriptManager is not injecting the proxy for the methods on the client side...


Finally I resolved the problem.
The solution is describe in this post from Shawn Burke's Blog. Due to a bug in this release of AJAX the page method must be in the same ASPX Page and not in codebehind.


Did you do anything to get the PageMethods object to appear on your page?

I've got public static void, I've got WebMethod and ScriptMethod, and I've got the function in the page rather than the code-behind... still nothing.


what the.......

okay... apparently closing the project, leaving it overnight, and changing absolutely nothing... fixed it... what do ya know. :p


This will break too much of my code...I think I will revert back to ATLAS until this is resolved/changed.